From e7ca4b66cb766f29dcf0bbbd6cb9aa8635fd6ef6 Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Fri, 5 Jan 2024 09:46:42 +0200 Subject: [PATCH] feat: create new reducers for ports and addresses --- src/redux/PairDevice/slice.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/redux/PairDevice/slice.ts b/src/redux/PairDevice/slice.ts index eacf915d..967dd1f7 100644 --- a/src/redux/PairDevice/slice.ts +++ b/src/redux/PairDevice/slice.ts @@ -20,21 +20,24 @@ const pairDeviceSlice = createSlice({ name: 'pairDevice', initialState, reducers: { - setAddress: ( - state, - action: PayloadAction<{ nodeAddress: string; beaconAddress: string; vcAddress: string }>, - ) => { - state.nodeAddress = action.payload.nodeAddress - state.beaconAddress = action.payload.beaconAddress - state.vcAddress = action.payload.vcAddress + setBeaconPort: (state, action: PayloadAction) => { + state.beaconPort = action.payload }, - setPort: (state, action: PayloadAction<{ beaconPort: string; vcPort: string }>) => { - state.beaconPort = action.payload.beaconPort - state.vcPort = action.payload.vcPort + setVcPort: (state, action: PayloadAction) => { + state.vcPort = action.payload + }, + setBeaconAddress: (state, action: PayloadAction) => { + state.beaconAddress = action.payload + }, + setVcAddress: (state, action: PayloadAction) => { + state.vcAddress = action.payload + }, + setNodeAddress: (state, action: PayloadAction) => { + state.nodeAddress = action.payload }, }, }) -export const { setAddress, setPort } = pairDeviceSlice.actions +export const {} = pairDeviceSlice.actions export default pairDeviceSlice.reducer