import { IUserModalsStore , TUserModalsAction } from './types' ; export enum UserModalsActionsEnum { SHOW_USER_REGISTERED = 'SHOW_USER_REGISTERED' , SHOW_LOGIN_REGISTER_ORG = 'SHOW_LOGIN_REGISTER_ORG' , SHOW_PENDING_INVITATION = 'SHOW_PENDING_INVITATION' , SHOW_CREATE_EXCHANGE_ADDRESS = 'SHOW_CREATE_EXCHANGE_ADDRESS' , SHOW_ROLE_CHANGED = 'SHOW_ROLE_CHANGED' } export const userModalsInitialState = { userRegistered : false , loginRegisterOrg : false , pendingInvitation : { open : false , invitation : null , user : null , } , createExchangeAddress : false , roleChanged : { open : false , user : null , } , } ; export const userModalsReducer = ( state = userModalsInitialState , action ) : IUserModalsStore => { switch ( action . type ) { case UserModalsActionsEnum . SHOW_USER_REGISTERED : return { ... state , userRegistered : action . payload } ; case UserModalsActionsEnum . SHOW_LOGIN_REGISTER_ORG : return { ... state , loginRegisterOrg : action . payload } ; case UserModalsActionsEnum . SHOW_PENDING_INVITATION : return { ... state , pendingInvitation : action . payload } ; case UserModalsActionsEnum . SHOW_CREATE_EXCHANGE_ADDRESS : return { ... state , createExchangeAddress : action . payload } ; case UserModalsActionsEnum . SHOW_ROLE_CHANGED : return { ... state , roleChanged : action . payload } ; } } ;