A newbie to ember, I am trying to simulate the API server using ember-cli-mirage. I am creating a request from account.js
through store
but the response is not something I expect.
## /app/routes/account.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default Route.extend({
store: service(),
model() {
this.store.findAll('accounts').then(response => {
console.log(response)
});
// return this.store.findAll('accounts');
}
});
## /app/mirage/config.js
export default function () {
this.get('/accounts', (schema) => {
return {
data: [
{
firstName: 'John'
}
]
};
}, {timing: 2000});
}
Is there anything missing?
Aucun commentaire:
Enregistrer un commentaire