dimanche 13 juin 2021

Ember Octane - Mirage requestbody null

I am newbie on ember.js, trying to do some tests with mirage. Only certain fields of model come true, but the others come as null. As I am a newbie, I am not sure if the reason is about these lines

Account.js

const accountId = this.args.account.id;
var data = this.store.createRecord('subscription', 
{
  id:1,
  accountId: accountId,
  startDate: Date.now(),
  endDate: Date.now()
});
data.save();

Mirage - Config.js

this.post('/subscriptions', (schema, request) => {
    let requestBody = JSON.parse(request.requestBody);
    schema.subscriptions.push(requestBody);
  }, {timing: 2000});



Aucun commentaire:

Enregistrer un commentaire