I am pushing my data in a controller to the ember store like this:
this.get('store').pushPayload({
"user": [
{
"id":2,
"name":this.get('name'),
"passwort":this.get('admin')
}
]
});
This works temporally fine but after a reload on a route which uses findAll to get all users from mirage the new user is deleted out of the store. So is there any possibility to hold the new user into the ember store or to push the new object into the mirage database? I´ve tried to send a post-request on my own like this:
$.ajax({
cache:false,
type: 'POST',
url: "/api/test",
data: JSON.stringify(myData),
contentType: "application/json",
success: function(data) {
//
}
});
My config.js part:
this.post('/test', function(schema, request) {
console.log('foo');
});
The foo comes up but how can I access my data? I have tried
this.post('/test', function(schema, request) {
console.log('foo');
console.log(request.data.user.name);
});
this does not work because user is undefined.