feat: add VITE_REDUX_STORAGE environment variable and update storage configuration
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Redux Persistence Location
|
||||||
|
VITE_REDUX_STORAGE=local
|
||||||
@@ -45,7 +45,7 @@ export default function HeroLayout() {
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
{/* Main Content Area */}
|
{/* Main Content Area */}
|
||||||
<main className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 flex-grow">
|
<main className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 grow">
|
||||||
<div className="px-4 py-6 sm:px-0">
|
<div className="px-4 py-6 sm:px-0">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-2
@@ -10,10 +10,11 @@ import {
|
|||||||
PURGE,
|
PURGE,
|
||||||
REGISTER,
|
REGISTER,
|
||||||
} from "redux-persist"
|
} from "redux-persist"
|
||||||
import storage from "redux-persist/lib/storage/session" // use session storage
|
import createWebStorage from "redux-persist/es/storage/createWebStorage"
|
||||||
// import storage from "redux-persist/lib/storage" // use local storage
|
|
||||||
import authReducer from "./auth-slice"
|
import authReducer from "./auth-slice"
|
||||||
|
|
||||||
|
const storage = createWebStorage(import.meta.env.VITE_REDUX_STORAGE ?? "local")
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
key: "root",
|
key: "root",
|
||||||
storage,
|
storage,
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
// todo add env properties here
|
readonly VITE_REDUX_STORAGE: "local" | "session"
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
Reference in New Issue
Block a user