feat: create new reducers for ports and addresses

This commit is contained in:
RadoslavDimchev 2024-01-05 09:46:42 +02:00
parent a7658bdde4
commit e7ca4b66cb
1 changed files with 14 additions and 11 deletions

View File

@ -20,21 +20,24 @@ const pairDeviceSlice = createSlice({
name: 'pairDevice', name: 'pairDevice',
initialState, initialState,
reducers: { reducers: {
setAddress: ( setBeaconPort: (state, action: PayloadAction<string>) => {
state, state.beaconPort = action.payload
action: PayloadAction<{ nodeAddress: string; beaconAddress: string; vcAddress: string }>,
) => {
state.nodeAddress = action.payload.nodeAddress
state.beaconAddress = action.payload.beaconAddress
state.vcAddress = action.payload.vcAddress
}, },
setPort: (state, action: PayloadAction<{ beaconPort: string; vcPort: string }>) => { setVcPort: (state, action: PayloadAction<string>) => {
state.beaconPort = action.payload.beaconPort state.vcPort = action.payload
state.vcPort = action.payload.vcPort },
setBeaconAddress: (state, action: PayloadAction<string>) => {
state.beaconAddress = action.payload
},
setVcAddress: (state, action: PayloadAction<string>) => {
state.vcAddress = action.payload
},
setNodeAddress: (state, action: PayloadAction<string>) => {
state.nodeAddress = action.payload
}, },
}, },
}) })
export const { setAddress, setPort } = pairDeviceSlice.actions export const {} = pairDeviceSlice.actions
export default pairDeviceSlice.reducer export default pairDeviceSlice.reducer