You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Essentially in our API we have an endpoint POST /workflows/default which when posted to with minimal required values will create a new 'workflow' based on some defaults they have saved.
However when trying the following...
let emptyWorkflow = this.get('store').createRecord('workflow');
emptyWorkflow.default(payload).then((workflow) => {
console.log('default wf created:', workflow); // << 'workflow' is undefined here!
}).finally(()=>{
emptyWorkflow.deleteRecord();
});
...nothing seems to be passed through to the .then the workflow param is undefined.
The backend does create the item though and responds with the attributes. I can also see via Ember inspector that the new 'workflow' is added to the store, however I'd like to get it's ID at the point of the console.log in the above example so I can transition to it.
I also tried setting the option pushToStore: false, then I get an object containing the backend API's response payload. Is it possible to get the actual Ember model object for the newly created item passed through to the .then()?
The text was updated successfully, but these errors were encountered:
Sorry my fault... I had a separate serializer defined for the model concerned. So while my main application serializer was using import { JSONAPISerializer } from 'ember-custom-actions' the one specific to the model was still using the default Ember data JSONAPISerializer.
I have a resourceAction defined on one of my models called 'workflow' like so:
Essentially in our API we have an endpoint
POST /workflows/default
which when posted to with minimal required values will create a new 'workflow' based on some defaults they have saved.However when trying the following...
...nothing seems to be passed through to the
.then
the workflow param is undefined.The backend does create the item though and responds with the attributes. I can also see via Ember inspector that the new 'workflow' is added to the store, however I'd like to get it's ID at the point of the console.log in the above example so I can transition to it.
I also tried setting the option
pushToStore: false
, then I get an object containing the backend API's response payload. Is it possible to get the actual Ember model object for the newly created item passed through to the.then()
?The text was updated successfully, but these errors were encountered: