import Route from '@ember/routing/route'; import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; import { inject as service } from '@ember/service'; const REZEPT_KATEGORIEN = [ 'Pasta', 'Schwein', 'Soße', 'Fleisch', 'Geflügel', 'Rind', 'Nachspeise', 'Backen' ]; export default class RezeptRoute extends Route{ @service store; async model() { return this.store.findAll('rezept'); } } /*async model() { let response = await fetch('/api/rezepte.json'); let { data } = await response.json(); return data.map(model => { let { attributes } = model; let kategorie; if (REZEPT_KATEGORIEN.includes(attributes.kategorie)) { kategorie = attributes.kategorie; } else { kategorie = 'Sonstiges'; } return { kategorie, ...attributes }; }); } }*/