import { Action } from 'redux' ; enum MyPeerIdActionTypes { SET_MY_PEER_ID = 'set-my-peer-id' } export type MyPeerIdReducerType = string | null ; interface SetMyPeerIdActionType extends Action { type : MyPeerIdActionTypes . SET_MY_PEER_ID ; myPeerId : MyPeerIdReducerType ; } export function setMyPeerIdAction ( myPeerId ) { return { type : MyPeerIdActionTypes . SET_MY_PEER_ID , myPeerId } ; } function myPeerIdReducer ( state = null , action ) { switch ( action . type ) { case MyPeerIdActionTypes . SET_MY_PEER_ID : return action . myPeerId ; default : return state ; } } export default myPeerIdReducer ;