Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Mirage error responses for jsonAPI ember-data

$
0
0

@teejay wrote:

Hello, I am currently struggling to create a valid error response in mirage for a patch request.

my config looks like this

server.patch(`api/v2/students/:id`, function () {
  // example Error response from the server
  return new Mirage.Response(422, {}, {
    errors: [
      {
        'status': 422,
        'title': 'wth',
        'detail': 'login has already been taken',
        'source': {
          'pointer': '/data/attributes/login',
        },
      },
    ],
  })
})

and when I try to save the model object via .save() I am presented with a super duper annoying error message-> The adapter rejected the commit because it was invalid

I am really a little clueless at this point and I hope someone could help me out with this one. I am using ember 2.18, same for ember data.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles