import { AnyAction } from "redux" ; import { governmentActions } from "../actionCreators/government" ; import { Map } from "immutable" ; import { MultisigTransaction } from "@joincivil/core/build/src/contracts/multisig/multisigtransaction" ; export function govtParameters ( state = { } , action ) { switch ( action . type ) { case governmentActions . SET_GOVT_PARAMETER : return { ... state , [ action . paramName ] : action . paramValue } ; case governmentActions . MULTI_SET_GOVT_PARAMETERS : return { ... state , ... action . params } ; default : return state ; } } export function govtProposals ( state = Map < string , object > ( ) , action ) { switch ( action . type ) { case governmentActions . ADD_OR_UPDATE_GOVT_PROPOSAL : const newState = state . set ( action . proposal . id , action . proposal ) ; return newState ; default : return state ; } } export function government ( state = Map < string , string > ( ) , action ) { switch ( action . type ) { case governmentActions . ADD_GOVERNMENT_DATA : return state . set ( action . data . key , action . data . value ) ; default : return state ; } } export function constitution ( state = Map < string , string > ( ) , action ) { switch ( action . type ) { case governmentActions . SET_CONSTITUTION_DATA : return state . set ( action . data . key , action . data . value ) ; default : return state ; } } export function appellate ( state = "" , action ) { switch ( action . type ) { case governmentActions . SET_APPELLATE : return action . data ; default : return state ; } } export function controller ( state = "" , action ) { switch ( action . type ) { case governmentActions . SET_CONTROLLER : return action . data ; default : return state ; } } export function appellateMembers ( state = [ "" ] , action ) { switch ( action . type ) { case governmentActions . SET_APPELLATE_MEMBERS : return action . data ; default : return state ; } } export function councilMultisigTransactions ( state = Map < string , MultisigTransaction > ( ) , action ) { switch ( action . type ) { case governmentActions . ADD_COUNCIL_MULTISIG_TRANSACTION : return state . set ( action . data . information . data . substring ( 0 , 74 ) , action . data ) ; default : return state ; } }