aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 15:38:59 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 15:38:59 -0700
commitf8643e6bd88c20cc13383a86f457d909cdd6ae6e (patch)
tree8a9ec30921684d822a4346907617d9bb94c12f80 /modern/src/store
parentcc03e41dd7f9f401797f39eb08e7d4617d624a2f (diff)
downloadetbsa-traccar-web-f8643e6bd88c20cc13383a86f457d909cdd6ae6e.tar.gz
etbsa-traccar-web-f8643e6bd88c20cc13383a86f457d909cdd6ae6e.tar.bz2
etbsa-traccar-web-f8643e6bd88c20cc13383a86f457d909cdd6ae6e.zip
Use proper session state
Diffstat (limited to 'modern/src/store')
-rw-r--r--modern/src/store/index.js3
-rw-r--r--modern/src/store/session.js16
2 files changed, 19 insertions, 0 deletions
diff --git a/modern/src/store/index.js b/modern/src/store/index.js
index 86de31a..432ef78 100644
--- a/modern/src/store/index.js
+++ b/modern/src/store/index.js
@@ -1,13 +1,16 @@
import { combineReducers, configureStore } from '@reduxjs/toolkit';
+import { sessionReducer as session } from './session';
import { devicesReducer as devices } from './devices';
import { positionsReducer as positions } from './positions';
const reducer = combineReducers({
+ session,
devices,
positions,
});
+export { sessionActions } from './session';
export { devicesActions } from './devices';
export { positionsActions } from './positions';
diff --git a/modern/src/store/session.js b/modern/src/store/session.js
new file mode 100644
index 0000000..772368c
--- /dev/null
+++ b/modern/src/store/session.js
@@ -0,0 +1,16 @@
+import { createSlice } from '@reduxjs/toolkit';
+
+const { reducer, actions } = createSlice({
+ name: 'session',
+ initialState: {
+ authenticated: false,
+ },
+ reducers: {
+ authenticated(state, action) {
+ state.authenticated = action.payload;
+ },
+ }
+});
+
+export { actions as sessionActions };
+export { reducer as sessionReducer };