Petro
Petro

Reputation: 21

Mirage JS add pagination data to response

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?

Upvotes: 1

Views: 352

Answers (0)

Related Questions