aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/CachingController.js38
-rw-r--r--modern/src/store/calendars.js16
-rw-r--r--modern/src/store/commands.js16
-rw-r--r--modern/src/store/computedAttributes.js16
-rw-r--r--modern/src/store/index.js13
-rw-r--r--modern/src/store/notifications.js16
6 files changed, 1 insertions, 114 deletions
diff --git a/modern/src/CachingController.js b/modern/src/CachingController.js
index faeec482..3f808de2 100644
--- a/modern/src/CachingController.js
+++ b/modern/src/CachingController.js
@@ -1,6 +1,6 @@
import { useDispatch, useSelector } from 'react-redux';
import { connect } from 'react-redux';
-import { geofencesActions, groupsActions, driversActions, calendarsActions, commandsActions, computedAttributesActions, maintenancesActions, notificationsActions } from './store';
+import { geofencesActions, groupsActions, driversActions, maintenancesActions } from './store';
import { useEffectAsync } from './reactHelper';
const CachingController = () => {
@@ -36,47 +36,11 @@ const CachingController = () => {
useEffectAsync(async () => {
if (authenticated) {
- const response = await fetch('/api/calendars');
- if (response.ok) {
- dispatch(calendarsActions.update(await response.json()));
- }
- }
- }, [authenticated]);
-
- useEffectAsync(async () => {
- if (authenticated) {
- const response = await fetch('/api/commands');
- if (response.ok) {
- dispatch(commandsActions.update(await response.json()));
- }
- }
- }, [authenticated]);
-
- useEffectAsync(async () => {
- if (authenticated) {
- const response = await fetch('/api/attributes/computed');
- if (response.ok) {
- dispatch(computedAttributesActions.update(await response.json()));
- }
- }
- }, [authenticated]);
-
- useEffectAsync(async () => {
- if (authenticated) {
const response = await fetch('/api/maintenance');
if (response.ok) {
dispatch(maintenancesActions.update(await response.json()));
}
}
- }, [authenticated]);
-
- useEffectAsync(async () => {
- if (authenticated) {
- const response = await fetch('/api/notifications');
- if (response.ok) {
- dispatch(notificationsActions.update(await response.json()));
- }
- }
}, [authenticated]);
return null;
diff --git a/modern/src/store/calendars.js b/modern/src/store/calendars.js
deleted file mode 100644
index 3aa4d890..00000000
--- a/modern/src/store/calendars.js
+++ /dev/null
@@ -1,16 +0,0 @@
-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/commands.js b/modern/src/store/commands.js
deleted file mode 100644
index d18d6097..00000000
--- a/modern/src/store/commands.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { createSlice } from '@reduxjs/toolkit';
-
-const { reducer, actions } = createSlice({
- name: 'commands',
- initialState: {
- items: {},
- },
- reducers: {
- update(state, action) {
- action.payload.forEach(item => state.items[item['id']] = item);
- },
- }
-});
-
-export { actions as commandsActions };
-export { reducer as commandsReducer };
diff --git a/modern/src/store/computedAttributes.js b/modern/src/store/computedAttributes.js
deleted file mode 100644
index d9e35319..00000000
--- a/modern/src/store/computedAttributes.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { createSlice } from '@reduxjs/toolkit';
-
-const { reducer, actions } = createSlice({
- name: 'computedAttributes',
- initialState: {
- items: {},
- },
- reducers: {
- update(state, action) {
- action.payload.forEach(item => state.items[item['id']] = item);
- },
- }
-});
-
-export { actions as computedAttributesActions };
-export { reducer as computedAttributesReducer };
diff --git a/modern/src/store/index.js b/modern/src/store/index.js
index 9163e445..6e2bb204 100644
--- a/modern/src/store/index.js
+++ b/modern/src/store/index.js
@@ -7,10 +7,6 @@ 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 { computedAttributesReducer as computedAttributes } from './computedAttributes';
-import { commandsReducer as commands } from './commands';
-import { notificationsReducer as notifications } from './notifications';
const reducer = combineReducers({
session,
@@ -20,11 +16,6 @@ const reducer = combineReducers({
groups,
drivers,
maintenances,
- calendars,
- computedAttributes,
- commands,
- notifications,
-
});
export { sessionActions } from './session';
@@ -34,9 +25,5 @@ export { geofencesActions } from './geofences';
export { groupsActions } from './groups';
export { driversActions } from './drivers';
export { maintenancesActions } from './maintenances';
-export { calendarsActions } from './calendars';
-export { computedAttributesActions } from './computedAttributes';
-export { commandsActions } from './commands';
-export { notificationsActions } from './notifications';
export default configureStore({ reducer });
diff --git a/modern/src/store/notifications.js b/modern/src/store/notifications.js
deleted file mode 100644
index be8a9890..00000000
--- a/modern/src/store/notifications.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { createSlice } from '@reduxjs/toolkit';
-
-const { reducer, actions } = createSlice({
- name: 'notifications',
- initialState: {
- items: {},
- },
- reducers: {
- update(state, action) {
- action.payload.forEach(item => state.items[item['id']] = item);
- },
- }
-});
-
-export { actions as notificationsActions };
-export { reducer as notificationsReducer };