aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/store')
-rw-r--r--modern/src/store/calendars.js16
-rw-r--r--modern/src/store/index.js3
2 files changed, 19 insertions, 0 deletions
diff --git a/modern/src/store/calendars.js b/modern/src/store/calendars.js
new file mode 100644
index 00000000..924288e6
--- /dev/null
+++ b/modern/src/store/calendars.js
@@ -0,0 +1,16 @@
+import { createSlice } from '@reduxjs/toolkit';
+
+const { reducer, actions } = createSlice({
+ name: 'calendars',
+ initialState: {
+ items: {},
+ },
+ reducers: {
+ update(state, action) {
+ action.payload.forEach((item) => state.items[item.id] = item);
+ },
+ },
+});
+
+export { actions as calendarsActions };
+export { reducer as calendarsReducer };
diff --git a/modern/src/store/index.js b/modern/src/store/index.js
index 0cc32d38..ea685ff3 100644
--- a/modern/src/store/index.js
+++ b/modern/src/store/index.js
@@ -8,6 +8,7 @@ import { geofencesReducer as geofences } from './geofences';
import { groupsReducer as groups } from './groups';
import { driversReducer as drivers } from './drivers';
import { maintenancesReducer as maintenances } from './maintenances';
+import { calendarsReducer as calendars } from './calendars';
import { reportsReducer as reports } from './reports';
import throttleMiddleware from './throttleMiddleware';
@@ -20,6 +21,7 @@ const reducer = combineReducers({
groups,
drivers,
maintenances,
+ calendars,
reports,
});
@@ -31,6 +33,7 @@ export { geofencesActions } from './geofences';
export { groupsActions } from './groups';
export { driversActions } from './drivers';
export { maintenancesActions } from './maintenances';
+export { calendarsActions } from './calendars';
export { reportsActions } from './reports';
export default configureStore({