add cards table and pagination

This commit is contained in:
2023-10-07 23:44:20 +02:00
parent 450d664f34
commit 33f3fc6137
21 changed files with 635 additions and 52 deletions

View File

@@ -1,4 +1,4 @@
import { DecksResponse } from './decks.types'
import { CardsResponse, DeckResponse, DecksResponse } from './decks.types'
import { baseApi } from '@/services'
@@ -7,7 +7,13 @@ const decksService = baseApi.injectEndpoints({
getDecks: builder.query<DecksResponse, void>({
query: () => `v1/decks`,
}),
getDeckById: builder.query<DeckResponse, { id: string }>({
query: ({ id }) => `v1/decks/${id}`,
}),
getDeckCards: builder.query<CardsResponse, { id: string }>({
query: ({ id }) => `v1/decks/${id}/cards`,
}),
}),
})
export const { useGetDecksQuery } = decksService
export const { useGetDecksQuery, useGetDeckByIdQuery, useGetDeckCardsQuery } = decksService