diff --git a/src/store/index.ts b/src/store/index.ts index 8517872..2ee3a4f 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -10,10 +10,11 @@ import { PURGE, REGISTER, } from "redux-persist" -import storage from "redux-persist/lib/storage/session" // use session storage -// import storage from "redux-persist/lib/storage" // use local storage +import createWebStorage from "redux-persist/es/storage/createWebStorage" import authReducer from "./auth-slice" +const storage = createWebStorage(import.meta.env.VITE_REDUX_STORAGE ?? "local") + const persistConfig = { key: "root", storage, diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 527ccb7..bacc388 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,6 +1,7 @@ /// interface ImportMetaEnv { readonly VITE_SEO_SITE_URL: string + readonly VITE_REDUX_STORAGE: string } interface ImportMeta {