aboutsummaryrefslogtreecommitdiff
path: root/modern/src/CachingController.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/CachingController.js')
-rw-r--r--modern/src/CachingController.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/modern/src/CachingController.js b/modern/src/CachingController.js
index 3f808de..d6e2006 100644
--- a/modern/src/CachingController.js
+++ b/modern/src/CachingController.js
@@ -1,10 +1,12 @@
-import { useDispatch, useSelector } from 'react-redux';
-import { connect } from 'react-redux';
-import { geofencesActions, groupsActions, driversActions, maintenancesActions } from './store';
+import { useDispatch, useSelector, connect } from 'react-redux';
+
+import {
+ geofencesActions, groupsActions, driversActions, maintenancesActions,
+} from './store';
import { useEffectAsync } from './reactHelper';
const CachingController = () => {
- const authenticated = useSelector(state => !!state.session.user);
+ const authenticated = useSelector((state) => !!state.session.user);
const dispatch = useDispatch();
useEffectAsync(async () => {
@@ -23,8 +25,8 @@ const CachingController = () => {
dispatch(groupsActions.update(await response.json()));
}
}
- }, [authenticated]);
-
+ }, [authenticated]);
+
useEffectAsync(async () => {
if (authenticated) {
const response = await fetch('/api/drivers');
@@ -33,7 +35,7 @@ const CachingController = () => {
}
}
}, [authenticated]);
-
+
useEffectAsync(async () => {
if (authenticated) {
const response = await fetch('/api/maintenance');
@@ -41,9 +43,9 @@ const CachingController = () => {
dispatch(maintenancesActions.update(await response.json()));
}
}
- }, [authenticated]);
-
+ }, [authenticated]);
+
return null;
-}
+};
export default connect()(CachingController);