rtk
This commit is contained in:
18
frontend/app/src/config/store.ts
Normal file
18
frontend/app/src/config/store.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { configureStore } from '@reduxjs/toolkit'
|
||||
import { setupListeners } from '@reduxjs/toolkit/query'
|
||||
import { AuthApi } from '../slice/AuthApi'
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
// Add the generated reducer as a specific top-level slice
|
||||
[AuthApi.reducerPath]: AuthApi.reducer,
|
||||
},
|
||||
// Adding the api middleware enables caching, invalidation, polling,
|
||||
// and other useful features of `rtk-query`.
|
||||
middleware: (getDefaultMiddleware) =>
|
||||
getDefaultMiddleware().concat(AuthApi.middleware),
|
||||
})
|
||||
|
||||
// optional, but required for refetchOnFocus/refetchOnReconnect behaviors
|
||||
// see `setupListeners` docs - takes an optional callback as the 2nd arg for customization
|
||||
setupListeners(store.dispatch)
|
||||
Reference in New Issue
Block a user