feat: add is advanced into slice

This commit is contained in:
RadoslavDimchev 2024-01-24 09:42:25 +02:00
parent b832ee70b0
commit 81fef16664
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import { createSlice } from '@reduxjs/toolkit'
import { BEACON, BEACON_PORT, DEFAULT_ADDRESS, VALIDATOR_CLIENT, VC_PORT } from '../../constants' import { BEACON, BEACON_PORT, DEFAULT_ADDRESS, VALIDATOR_CLIENT, VC_PORT } from '../../constants'
type PairDeviceStateType = { type PairDeviceStateType = {
isAdvanced: boolean
beaconPort: string beaconPort: string
vcPort: string vcPort: string
nodeAddress: string nodeAddress: string
@ -14,6 +15,7 @@ type PairDeviceStateType = {
} }
const initialState: PairDeviceStateType = { const initialState: PairDeviceStateType = {
isAdvanced: false,
beaconPort: BEACON_PORT, beaconPort: BEACON_PORT,
vcPort: VC_PORT, vcPort: VC_PORT,
nodeAddress: DEFAULT_ADDRESS, nodeAddress: DEFAULT_ADDRESS,
@ -28,6 +30,9 @@ const pairDeviceSlice = createSlice({
name: 'pairDevice', name: 'pairDevice',
initialState, initialState,
reducers: { reducers: {
setIsAdvanced: (state, action) => {
state.isAdvanced = action.payload
},
setPort: (state, action) => { setPort: (state, action) => {
if (action.payload.portType === BEACON) { if (action.payload.portType === BEACON) {
state.beaconPort = action.payload.value state.beaconPort = action.payload.value