jeudi 3 août 2017

Mirage + JSONAPI Array

I have a basic api that is setup like so...

/api/v1/logs/
/api/v1/logs/type1-logs
/api/v1/logs/type2-logs
/api/v1/logs/type3-logs

They each only support GET, and if the user makes a request to /api/v1/logs they should be getting all of the logs.

I have the factories, and scenarios setup in Mirage, but I'm unsure how to actually return an array of different types.

My current config.js is causing ember to complain about an undefined resource type.

  this.get('/logs', function(db, request) {
    let data = {
      data: [
        db.type1Logs,
        db.type2Logs,
        db.type3Logs
      ]
    };
    return data;
  });

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire