feat: add state and reducers for checks and switches
This commit is contained in:
parent
3131510d51
commit
518dbd524f
|
@ -6,6 +6,12 @@ type PairDeviceStateType = {
|
||||||
nodeAddress: string
|
nodeAddress: string
|
||||||
beaconAddress: string
|
beaconAddress: string
|
||||||
vcAddress: string
|
vcAddress: string
|
||||||
|
isNodeSwitchOn: boolean
|
||||||
|
isBeaconSwitchOn: boolean
|
||||||
|
isVcSwitchOn: boolean
|
||||||
|
isNodeChecked: boolean
|
||||||
|
isBeaconChecked: boolean
|
||||||
|
isVcChecked: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState: PairDeviceStateType = {
|
const initialState: PairDeviceStateType = {
|
||||||
|
@ -14,6 +20,12 @@ const initialState: PairDeviceStateType = {
|
||||||
nodeAddress: 'http://124.0.0.1',
|
nodeAddress: 'http://124.0.0.1',
|
||||||
beaconAddress: 'http://124.0.0.1',
|
beaconAddress: 'http://124.0.0.1',
|
||||||
vcAddress: 'http://124.0.0.1',
|
vcAddress: 'http://124.0.0.1',
|
||||||
|
isNodeSwitchOn: false,
|
||||||
|
isBeaconSwitchOn: false,
|
||||||
|
isVcSwitchOn: false,
|
||||||
|
isNodeChecked: false,
|
||||||
|
isBeaconChecked: false,
|
||||||
|
isVcChecked: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const pairDeviceSlice = createSlice({
|
const pairDeviceSlice = createSlice({
|
||||||
|
@ -36,6 +48,24 @@ const pairDeviceSlice = createSlice({
|
||||||
state.nodeAddress = action.payload.value
|
state.nodeAddress = action.payload.value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setIsSwitchOn: (state, action) => {
|
||||||
|
if (action.payload.switchType === 'Beacon') {
|
||||||
|
state.isBeaconSwitchOn = action.payload.value
|
||||||
|
} else if (action.payload.switchType === 'Validator Client') {
|
||||||
|
state.isVcSwitchOn = action.payload.value
|
||||||
|
} else {
|
||||||
|
state.isNodeSwitchOn = action.payload.value
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setIsChecked: (state, action) => {
|
||||||
|
if (action.payload.checkType === 'Beacon') {
|
||||||
|
state.isBeaconChecked = action.payload.value
|
||||||
|
} else if (action.payload.checkType === 'Validator Client') {
|
||||||
|
state.isVcChecked = action.payload.value
|
||||||
|
} else {
|
||||||
|
state.isNodeChecked = action.payload.value
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue