So I added an http-mock for users that returns just a single user on the get route like so...
usersRouter.get('/:id', function(req, res) {
res.send({
"users": {
"id": 1,
"pin": 1234,
"first_name": "John",
"last_name": "Doe",
"email": "email@example.com",
"phone": 8436376960
}
});
});
In my model I have this
import DS from 'ember-data';
export default DS.Model.extend({
pin: DS.attr('number'),
first_name: DS.attr('string'),
last_name: DS.attr('string'),
email: DS.attr('string'),
phone: DS.attr('number')
});
and in my action when I submit a form I have this to perform the get request
return this.store.find('user',id);
when I click on the submit button I see in the console a 404 error to the get url like so
GET http://localhost:4200/users/1 404 (Not Found)
do I need to do anything else to get this mock to work? I didn't see anything about needing an adapter or serializer to get the mock to work
Aucun commentaire:
Enregistrer un commentaire