Skip to content

Commit

Permalink
DBC22-1469: store config fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-oxd committed Jan 10, 2024
1 parent c6a0bc8 commit a68e874
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/frontend/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,20 @@ import {
} from 'redux-persist';

import localforage from 'localforage';
import expireReducer from 'redux-persist-expire';
import storage from 'redux-persist/lib/storage';

const getConfig = (key, lifeInSeconds) => {
const config = {
const getConfig = (key) => {
return {
key: key,
storage: localforage,
};

if (lifeInSeconds) {
config.transforms = [
expireReducer('preference', {
expireSeconds: lifeInSeconds,
})
];
}

return config;
}

const store = configureStore({
reducer: {
cameras: persistReducer(getConfig('cameras', 60), camerasReducer),
cms: persistReducer(getConfig('cms', 60), cmsReducer),
events: persistReducer(getConfig('events', 60), eventsReducer),
cameras: persistReducer(getConfig('cameras'), camerasReducer),
cms: persistReducer(getConfig('cms'), cmsReducer),
events: persistReducer(getConfig('events'), eventsReducer),
routes: persistReducer(getConfig('routes'), routesReducer),
map: persistReducer(getConfig('map'), mapReducer),
},
Expand Down

0 comments on commit a68e874

Please sign in to comment.