feat: delete state and reducer for checked addresses

This commit is contained in:
RadoslavDimchev 2024-01-23 22:09:43 +02:00
parent efd4e26cf2
commit 00ff0138ac
3 changed files with 1 additions and 25 deletions

View File

@ -20,8 +20,6 @@ const ConnectViaIP = () => {
vcAddress,
isBeaconSwitchOn,
isVcSwitchOn,
isBeaconChecked,
isVcChecked,
} = useSelector((state: RootState) => state.pairDevice)
const changeApiToken = (value: string) => {
@ -56,7 +54,6 @@ const ConnectViaIP = () => {
port={vcPort}
isAdvanced={isAdvanced}
isSwitchOn={isVcSwitchOn}
isChecked={isVcChecked}
/>
<InputsRow
addressType={BEACON}
@ -65,7 +62,6 @@ const ConnectViaIP = () => {
port={beaconPort}
isAdvanced={isAdvanced}
isSwitchOn={isBeaconSwitchOn}
isChecked={isBeaconChecked}
/>
</YStack>
) : (

View File

@ -25,9 +25,8 @@ const InputsRow = ({
address,
port,
isSwitchOn,
isChecked,
}: InputsRowProps) => {
const { beaconPort, vcPort, isNodeChecked, isNodeSwitchOn } = useSelector(
const { beaconPort, vcPort, isNodeSwitchOn } = useSelector(
(state: RootState) => state.pairDevice,
)
const dispatch = useDispatch()
@ -40,10 +39,6 @@ const InputsRow = ({
dispatch({ type: 'pairDevice/setIsSwitchOn', payload: { value, switchType: addressType } })
}
const onCheckboxChange = (value: boolean) => {
dispatch({ type: 'pairDevice/setIsChecked', payload: { value, checkType: addressType } })
}
const onAddressChange = (value: string) => {
dispatch({ type: 'pairDevice/setAddress', payload: { value, addressType } })
}

View File

@ -11,9 +11,6 @@ type PairDeviceStateType = {
isNodeSwitchOn: boolean
isBeaconSwitchOn: boolean
isVcSwitchOn: boolean
isNodeChecked: boolean
isBeaconChecked: boolean
isVcChecked: boolean
}
const initialState: PairDeviceStateType = {
@ -25,9 +22,6 @@ const initialState: PairDeviceStateType = {
isNodeSwitchOn: true,
isBeaconSwitchOn: true,
isVcSwitchOn: true,
isNodeChecked: true,
isBeaconChecked: true,
isVcChecked: true,
}
const pairDeviceSlice = createSlice({
@ -59,15 +53,6 @@ const pairDeviceSlice = createSlice({
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
}
},
},
})