From 006ee184700c3fb04267950e52a39c697500e66c Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Fri, 16 Apr 2021 19:02:35 +0530 Subject: Rename the MainController to CachingController --- modern/src/App.js | 4 ++-- modern/src/CachingController.js | 22 ++++++++++++++++++++++ modern/src/MainController.js | 22 ---------------------- 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 modern/src/CachingController.js delete mode 100644 modern/src/MainController.js (limited to 'modern/src') diff --git a/modern/src/App.js b/modern/src/App.js index ef5fd204..7f8a5829 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -30,7 +30,7 @@ import MaintenancesPage from './settings/MaintenancesPage'; import MaintenancePage from './settings/MaintenancePage'; import StatisticsPage from './admin/StatisticsPage'; -import MainController from './MainController'; +import CachingController from './CachingController'; const App = () => { const initialized = useSelector(state => !!state.session.server && !!state.session.user); @@ -39,7 +39,7 @@ const App = () => { <> - + diff --git a/modern/src/CachingController.js b/modern/src/CachingController.js new file mode 100644 index 00000000..7adb39b8 --- /dev/null +++ b/modern/src/CachingController.js @@ -0,0 +1,22 @@ +import { useDispatch, useSelector } from 'react-redux'; +import { connect } from 'react-redux'; +import { geofencesActions } from './store'; +import { useEffectAsync } from './reactHelper'; + + +const CachingController = () => { + const authenticated = useSelector(state => !!state.session.user); + const dispatch = useDispatch(); + + useEffectAsync(async () => { + if (authenticated) { + const response = await fetch('/api/geofences'); + if (response.ok) { + dispatch(geofencesActions.update(await response.json())); + } + } + }, [authenticated]); + return null; +} + +export default connect()(CachingController); diff --git a/modern/src/MainController.js b/modern/src/MainController.js deleted file mode 100644 index f8f6d684..00000000 --- a/modern/src/MainController.js +++ /dev/null @@ -1,22 +0,0 @@ -import { useDispatch, useSelector } from 'react-redux'; -import { connect } from 'react-redux'; -import { geofencesActions } from './store'; -import { useEffectAsync } from './reactHelper'; - - -const MainController = () => { - const authenticated = useSelector(state => !!state.session.user); - const dispatch = useDispatch(); - - useEffectAsync(async () => { - if (authenticated) { - const response = await fetch('/api/geofences'); - if (response.ok) { - dispatch(geofencesActions.update(await response.json())); - } - } - }, [authenticated]); - return null; -} - -export default connect()(MainController); -- cgit v1.2.3