mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-19 16:08:39 -05:00
store to ts
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ import App from "./App.jsx";
|
||||
import "./index.css";
|
||||
import { BrowserRouter as Router } from "react-router-dom";
|
||||
import { Provider } from "react-redux";
|
||||
import { persistor, store } from "./store.js";
|
||||
import { persistor, store } from "@/store.js";
|
||||
import { PersistGate } from "redux-persist/integration/react";
|
||||
import I18nLoader from "./Components/v1/I18nLoader/index.jsx";
|
||||
import { initApiClient } from "./Utils/ApiClient.js";
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
||||
|
||||
import authReducer from "./Features/Auth/authSlice";
|
||||
import uiReducer from "./Features/UI/uiSlice";
|
||||
import authReducer from "@/Features/Auth/authSlice";
|
||||
import uiReducer from "@/Features/UI/uiSlice";
|
||||
import storage from "redux-persist/lib/storage";
|
||||
import { persistReducer, persistStore, createTransform } from "redux-persist";
|
||||
import {
|
||||
persistReducer,
|
||||
persistStore,
|
||||
createTransform,
|
||||
PERSIST,
|
||||
REHYDRATE,
|
||||
} from "redux-persist";
|
||||
|
||||
const authTransform = createTransform(
|
||||
(inboundState) => {
|
||||
(inboundState: Record<string, unknown>) => {
|
||||
const { profileImage, ...rest } = inboundState;
|
||||
return rest;
|
||||
},
|
||||
// No transformation on rehydration
|
||||
null,
|
||||
// Only applies to auth
|
||||
undefined,
|
||||
{ whitelist: ["auth"] }
|
||||
);
|
||||
|
||||
@@ -28,6 +31,7 @@ const rootReducer = combineReducers({
|
||||
ui: uiReducer,
|
||||
});
|
||||
|
||||
// @ts-expect-error - redux-persist types don't align perfectly with redux-toolkit
|
||||
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
||||
|
||||
export const store = configureStore({
|
||||
@@ -35,10 +39,13 @@ export const store = configureStore({
|
||||
middleware: (getDefaultMiddleware) =>
|
||||
getDefaultMiddleware({
|
||||
serializableCheck: {
|
||||
ignoredActions: ["persist/PERSIST", "persist/REHYDRATE", "persist/REGISTER"],
|
||||
ignoredActions: [PERSIST, REHYDRATE, "persist/REGISTER"],
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
export type RootState = ReturnType<typeof rootReducer>;
|
||||
export type AppDispatch = typeof store.dispatch;
|
||||
|
||||
export const persistor = persistStore(store);
|
||||
export default store;
|
||||
Reference in New Issue
Block a user