From cbb68d36cf297064b8479ab8ff4172bbd34c84af Mon Sep 17 00:00:00 2001 From: Hristo Nedelkov Date: Mon, 18 Mar 2024 13:41:45 +0200 Subject: [PATCH] feat(navigation): create redux for navigation flow --- src/pages/PairDevice/PairDevice.tsx | 2 +- src/redux/NavigationFlow/slice.ts | 23 +++++++++++++++++++++++ src/redux/store.ts | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/redux/NavigationFlow/slice.ts diff --git a/src/pages/PairDevice/PairDevice.tsx b/src/pages/PairDevice/PairDevice.tsx index 386b566e..791a54ee 100644 --- a/src/pages/PairDevice/PairDevice.tsx +++ b/src/pages/PairDevice/PairDevice.tsx @@ -40,7 +40,7 @@ const PairDevice = () => { setIsConnectingViaIp(state => !state) } - const continueHandler = (e: Event) => { + const continueHandler = () => { navigate('/device-health-check') } diff --git a/src/redux/NavigationFlow/slice.ts b/src/redux/NavigationFlow/slice.ts new file mode 100644 index 00000000..c3495879 --- /dev/null +++ b/src/redux/NavigationFlow/slice.ts @@ -0,0 +1,23 @@ +import { createSlice } from '@reduxjs/toolkit' + +type NavigationFlowStateType = { + navigationFlow:string +} + +const initialState: NavigationFlowStateType = { + navigationFlow: '', +} + +const NavigationFlow = createSlice({ + name: 'navigationFlow', + initialState, + reducers: { + setNavigationFlow: (state, action) => { + state.navigationFlow = action.payload + }, + }, +}) + +export const { setNavigationFlow } = NavigationFlow.actions + +export default NavigationFlow.reducer diff --git a/src/redux/store.ts b/src/redux/store.ts index 3dfc2903..b39e14b6 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -15,6 +15,7 @@ import pairDeviceReducer from './PairDevice/slice' import manageValidatorTabReducer from './ManageValidatorTab/slice' import logsTerminalReducer from './LogsTerminal/slice' import currencyReducer from './Currency/slice' +import navigationFlowReducer from './NavigationFlow/slice' const store = configureStore({ reducer: { @@ -33,6 +34,7 @@ const store = configureStore({ manageValidatorTab: manageValidatorTabReducer, logsTerminal: logsTerminalReducer, currency: currencyReducer, + navigationFLow: navigationFlowReducer, }, })