fix redux-persist server-side error msg
This commit is contained in:
parent
aa86a71dc6
commit
fe072f5ddd
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "proxyraye-next",
|
"name": "proxyraye-next",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "proxyraye-next",
|
"name": "proxyraye-next",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@picocss/pico": "^2.0.6",
|
"@picocss/pico": "^2.0.6",
|
||||||
"@reduxjs/toolkit": "^2.2.3",
|
"@reduxjs/toolkit": "^2.2.3",
|
||||||
|
|
|
@ -4,7 +4,24 @@ import { useDispatch, TypedUseSelectorHook, useSelector } from "react-redux";
|
||||||
import { settingsReducer } from "@/store/settingsSlice";
|
import { settingsReducer } from "@/store/settingsSlice";
|
||||||
|
|
||||||
import { persistReducer } from "redux-persist";
|
import { persistReducer } from "redux-persist";
|
||||||
import storage from "redux-persist/lib/storage";
|
|
||||||
|
import createWebStorage from "redux-persist/lib/storage/createWebStorage";
|
||||||
|
|
||||||
|
const createNoopStorage = () => {
|
||||||
|
return {
|
||||||
|
getItem(_key: any) {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
},
|
||||||
|
setItem(_key: any, value: any) {
|
||||||
|
return Promise.resolve(value);
|
||||||
|
},
|
||||||
|
removeItem(_key: any) {
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const storage = typeof window !== "undefined" ? createWebStorage("local") : createNoopStorage();
|
||||||
|
|
||||||
const settingsPersistConfig = {
|
const settingsPersistConfig = {
|
||||||
key: "settings",
|
key: "settings",
|
||||||
|
|
Loading…
Reference in New Issue