save state of code

This commit is contained in:
Alexander Bentkamp
2022-12-14 14:02:57 +01:00
parent 4114cbc304
commit 32b9d028a7
7 changed files with 63 additions and 15 deletions
+24
View File
@@ -0,0 +1,24 @@
import { configureStore } from '@reduxjs/toolkit';
import { connection } from '../connection'
import thunkMiddleware from 'redux-thunk'
import { apiSlice } from './api'
import { progressSlice } from './progress'
export const store = configureStore({
reducer: {
[apiSlice.reducerPath]: apiSlice.reducer,
[progressSlice.name]: progressSlice.reducer,
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware({
thunk: {
extraArgument: { connection }
}
}).concat(apiSlice.middleware),
});
// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch