Mirage JS add pagination data to response

333 Views Asked by At

I have a problem with mocking backend by mirage JS. How to add pagination data to response after creatList?

My server js returns JSON https://miragejs.com/repl/v2/6563736c78

{
  "users": [
    {
      "title": "test title",
      "id": "1"
    },
    {
      "title": "test title",
      "id": "2"
    },
    {
      "title": "test title",
      "id": "3"
    }
  ]
}

I want response

{
  "users": [
    {
      "title": "test title",
      "id": "1"
    },
    {
      "title": "test title",
      "id": "2"
    },
    {
      "title": "test title",
      "id": "3"
    }
  ],
  page: 1,
  total: 10
}

Can anybody help me with this?

0

There are 0 best solutions below