feat: create slice for pair device
This commit is contained in:
parent
a0ac3f819a
commit
115d139457
|
@ -0,0 +1,40 @@
|
|||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
||||
|
||||
type PairDeviceStateType = {
|
||||
beaconPort: string
|
||||
vcPort: string
|
||||
nodeAddress: string
|
||||
beaconAddress: string
|
||||
vcAddress: string
|
||||
}
|
||||
|
||||
const initialState: PairDeviceStateType = {
|
||||
beaconPort: '5052',
|
||||
vcPort: '9000',
|
||||
nodeAddress: 'http://124.0.0.1',
|
||||
beaconAddress: 'http://124.0.0.1',
|
||||
vcAddress: 'http://124.0.0.1',
|
||||
}
|
||||
|
||||
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
|
||||
},
|
||||
setPort: (state, action: PayloadAction<{ beaconPort: string; vcPort: string }>) => {
|
||||
state.beaconPort = action.payload.beaconPort
|
||||
state.vcPort = action.payload.vcPort
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export const { setAddress, setPort } = pairDeviceSlice.actions
|
||||
|
||||
export default pairDeviceSlice.reducer
|
|
@ -11,6 +11,7 @@ import rightSidebarReducer from './RightSidebar/slice'
|
|||
import validatorOnboardingReducer from './ValidatorOnboarding/slice'
|
||||
import advisoriesReducer from './ValidatorOnboarding/Advisories/slice'
|
||||
import validatorSetupReducer from './ValidatorOnboarding/ValidatorSetup/slice'
|
||||
import pairDeviceReducer from './PairDevice/slice'
|
||||
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
|
@ -25,6 +26,7 @@ const store = configureStore({
|
|||
validatorOnboarding: validatorOnboardingReducer,
|
||||
advisories: advisoriesReducer,
|
||||
validatorSetup: validatorSetupReducer,
|
||||
pairDevice: pairDeviceReducer,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue