I have following function:
this.store.createRecord('user', params).save().then(()=>{
this.set('responseModal', 'Utworzono użytkownika!');
})
And my question is: Why Ember push record to store before response from server? For example: I'm filling form incorrectly, and my server return with error and status: 400, but my record without it's id-key is still in store. I tried something like this:
.catch(()=>{
user.unloadRecord();
});
But it looks bad, when something record display and instantly hide. Is something way to create record in store only after response from server without external libraries? I want to use only ember-data to connect client with the server. Any advice and suggestions will be appreciated
Aucun commentaire:
Enregistrer un commentaire