From f8643e6bd88c20cc13383a86f457d909cdd6ae6e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 Jun 2020 15:38:59 -0700 Subject: Use proper session state --- modern/src/store/index.js | 3 +++ modern/src/store/session.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 modern/src/store/session.js (limited to 'modern/src/store') diff --git a/modern/src/store/index.js b/modern/src/store/index.js index 86de31a9..432ef78e 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 00000000..772368c4 --- /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 }; -- cgit v1.2.3