You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rezepte.js 949B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import Route from '@ember/routing/route';
  2. import Component from '@glimmer/component';
  3. import { tracked } from '@glimmer/tracking';
  4. import { action } from '@ember/object';
  5. import { inject as service } from '@ember/service';
  6. const REZEPT_KATEGORIEN = [
  7. 'Pasta',
  8. 'Schwein',
  9. 'Soße',
  10. 'Fleisch',
  11. 'Geflügel',
  12. 'Rind',
  13. 'Nachspeise',
  14. 'Backen'
  15. ];
  16. export default class RezeptRoute extends Route{
  17. @service store;
  18. async model() {
  19. return this.store.findAll('rezept');
  20. }
  21. }
  22. /*async model() {
  23. let response = await fetch('/api/rezepte.json');
  24. let { data } = await response.json();
  25. return data.map(model => {
  26. let { attributes } = model;
  27. let kategorie;
  28. if (REZEPT_KATEGORIEN.includes(attributes.kategorie)) {
  29. kategorie = attributes.kategorie;
  30. }
  31. else
  32. {
  33. kategorie = 'Sonstiges';
  34. }
  35. return { kategorie, ...attributes };
  36. });
  37. }
  38. }*/