lesson 3 in progress

This commit is contained in:
andres
2023-08-05 17:09:50 +02:00
parent 6988feae78
commit 4e301916f4
9 changed files with 96 additions and 15 deletions

21
src/services/base-api.ts Normal file
View File

@@ -0,0 +1,21 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
export const baseApi = createApi({
reducerPath: 'baseApi',
baseQuery: fetchBaseQuery({
baseUrl: 'https://api.flashcards.andrii.es',
credentials: 'include',
prepareHeaders: headers => {
headers.append('x-auth-skip', 'true')
},
}),
endpoints: builder => {
return {
getDecks: builder.query<any, void>({
query: () => `v1/decks`,
}),
}
},
})
export const { useGetDecksQuery } = baseApi