1

I'm building this VueJS app with MirageJS to mock an API and I came up with this issue. I have a /users endpoint where it handles GET and POST requests. If data is created by a factory, it returns this data. If data is created by a POST request, in a form, I receive a Created - 201 message but when I make a GET request again, this POST created data isn't there. Does MirageJS only persists data created by a factory?

Here is the code

enter image description here

This server dump returns the created data, but when I make a another GET request, it is empty.

Demo https://i.stack.imgur.com/BeeBJ.jpg

Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104
Gabriel Silva
  • 69
  • 1
  • 9
  • 1
    Nope, what you have looks right. `schema.users.create(attrs)` will create a db record. Try adding a debugger at the end of your POST handler and run `server.db.dump()` to see if the new data is in the database. Also if you upload a reproduction I can take a look! – Sam Selikoff Mar 19 '20 at 19:32

0 Answers0