mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-01-22 09:19:28 +00:00
feat: create slice for pair device
This commit is contained in:
parent
a0ac3f819a
commit
115d139457
40
src/redux/PairDevice/slice.ts
Normal file
40
src/redux/PairDevice/slice.ts
Normal file
@ -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 validatorOnboardingReducer from './ValidatorOnboarding/slice'
|
||||||
import advisoriesReducer from './ValidatorOnboarding/Advisories/slice'
|
import advisoriesReducer from './ValidatorOnboarding/Advisories/slice'
|
||||||
import validatorSetupReducer from './ValidatorOnboarding/ValidatorSetup/slice'
|
import validatorSetupReducer from './ValidatorOnboarding/ValidatorSetup/slice'
|
||||||
|
import pairDeviceReducer from './PairDevice/slice'
|
||||||
|
|
||||||
const store = configureStore({
|
const store = configureStore({
|
||||||
reducer: {
|
reducer: {
|
||||||
@ -25,6 +26,7 @@ const store = configureStore({
|
|||||||
validatorOnboarding: validatorOnboardingReducer,
|
validatorOnboarding: validatorOnboardingReducer,
|
||||||
advisories: advisoriesReducer,
|
advisories: advisoriesReducer,
|
||||||
validatorSetup: validatorSetupReducer,
|
validatorSetup: validatorSetupReducer,
|
||||||
|
pairDevice: pairDeviceReducer,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user