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>
|
||||
|
||||
{/* 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">
|
||||
<Outlet />
|
||||
</div>
|
||||
|
||||
+3
-2
@@ -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,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
/// <reference types="vite/client" />
|
||||
interface ImportMetaEnv {
|
||||
// todo add env properties here
|
||||
readonly VITE_REDUX_STORAGE: "local" | "session"
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
||||
Reference in New Issue
Block a user