monkey-front-core 0.0.317 → 0.0.318
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/store/reducers/monkeyecx-seeder.reducer.mjs +36 -25
- package/fesm2015/monkey-front-core.mjs +29 -18
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +35 -24
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/monkey-front-core-0.0.318.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.317.tgz +0 -0
|
@@ -2455,39 +2455,50 @@ const seederReducer = (keys) => {
|
|
|
2455
2455
|
return (reducer) => {
|
|
2456
2456
|
return (state, action) => {
|
|
2457
2457
|
const handledState = reducer(state, action);
|
|
2458
|
-
let data = handledState;
|
|
2459
2458
|
if (action.type === INIT || action.type === UPDATE) {
|
|
2460
|
-
|
|
2461
|
-
if (storageValue) {
|
|
2462
|
-
try {
|
|
2463
|
-
const handled = {
|
|
2464
|
-
...handledState,
|
|
2465
|
-
...JSON.parse(atob(storageValue))
|
|
2466
|
-
};
|
|
2467
|
-
return handled;
|
|
2468
|
-
}
|
|
2469
|
-
catch {
|
|
2470
|
-
localStorage.removeItem('mecx-store');
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
data = null;
|
|
2459
|
+
let data = null;
|
|
2474
2460
|
try {
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
...data,
|
|
2478
|
-
[key]: handledState[key]
|
|
2479
|
-
};
|
|
2480
|
-
});
|
|
2481
|
-
const handled = JSON.stringify(data);
|
|
2461
|
+
const storage = localStorage.getItem('mecx-store');
|
|
2462
|
+
const handled = atob(storage || '');
|
|
2482
2463
|
if (handled !== '{}') {
|
|
2483
|
-
|
|
2464
|
+
const storageValue = JSON.parse(atob(storage || ''));
|
|
2465
|
+
keys.forEach((key) => {
|
|
2466
|
+
let value = null;
|
|
2467
|
+
if (storageValue?.[key]) {
|
|
2468
|
+
value = {
|
|
2469
|
+
[key]: storageValue?.[key]
|
|
2470
|
+
};
|
|
2471
|
+
}
|
|
2472
|
+
data = {
|
|
2473
|
+
...data,
|
|
2474
|
+
...value
|
|
2475
|
+
};
|
|
2476
|
+
});
|
|
2484
2477
|
}
|
|
2478
|
+
return data;
|
|
2485
2479
|
}
|
|
2486
2480
|
catch (e) {
|
|
2487
2481
|
localStorage.removeItem('mecx-store');
|
|
2482
|
+
return handledState;
|
|
2488
2483
|
}
|
|
2489
2484
|
}
|
|
2490
|
-
|
|
2485
|
+
let data = null;
|
|
2486
|
+
try {
|
|
2487
|
+
keys.forEach((key) => {
|
|
2488
|
+
data = {
|
|
2489
|
+
...data,
|
|
2490
|
+
[key]: handledState[key]
|
|
2491
|
+
};
|
|
2492
|
+
});
|
|
2493
|
+
const handled = JSON.stringify(data);
|
|
2494
|
+
if (handled !== '{}') {
|
|
2495
|
+
localStorage.setItem('mecx-store', btoa(JSON.stringify(data)));
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
catch (e) {
|
|
2499
|
+
localStorage.removeItem('mecx-store');
|
|
2500
|
+
}
|
|
2501
|
+
return handledState;
|
|
2491
2502
|
};
|
|
2492
2503
|
};
|
|
2493
2504
|
};
|