-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f176af6
commit 46da7a7
Showing
8 changed files
with
84 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { combineReducers, configureStore } from "@reduxjs/toolkit"; | ||
import ccReducer from "./ccSlice"; | ||
import settingsReducer from "./settingsSlice"; | ||
import storage from "redux-persist/lib/storage"; | ||
import { | ||
persistStore, | ||
persistReducer, | ||
FLUSH, | ||
REHYDRATE, | ||
PAUSE, | ||
PERSIST, | ||
PURGE, | ||
REGISTER, | ||
} from "redux-persist"; | ||
|
||
const persistConfig = { | ||
key: "root", | ||
storage, | ||
}; | ||
|
||
const rootReducer = combineReducers({ | ||
cc: ccReducer, | ||
settings: settingsReducer, | ||
}); | ||
|
||
const persistedReducer = persistReducer(persistConfig, rootReducer); | ||
|
||
export const store = configureStore({ | ||
reducer: persistedReducer, | ||
middleware: (getDefaultMiddleware) => | ||
getDefaultMiddleware({ | ||
serializableCheck: { | ||
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], | ||
}, | ||
}), | ||
}); | ||
export const persistor = persistStore(store); | ||
|
||
// 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; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
/// <reference types="vite/client" /> | ||
import type { Action, Reducer } from "redux"; | ||
import type { PersistConfig, PersistState } from "redux-persist"; | ||
|
||
declare module "redux-persist" { | ||
export function persistReducer<S, A extends Action = Action, P = S>( | ||
config: PersistConfig<S>, | ||
baseReducer: Reducer<S, A, P> | ||
): Reducer< | ||
S & { _persist: PersistState }, | ||
A, | ||
P & { _persist?: PersistState } | ||
>; | ||
} |