import { Reducer } from 'umi' ; import settings from '@/config/settings' ; export interface GlobalModelState { collapsed : boolean ; topNavEnable : boolean ; headFixed : boolean ; } export interface GlobalModelType { namespace : 'global' ; state : GlobalModelState ; effects : { } ; reducers : { changeLayoutCollapsed : Reducer < GlobalModelState > ; setTopNavEnable : Reducer < GlobalModelState > ; setHeadFixed : Reducer < GlobalModelState > ; } ; } const initState = { collapsed : false , topNavEnable : settings . topNavEnable , headFixed : settings . headFixed , } ; const GlobalModel = { namespace : 'global' , state : initState , effects : { } , reducers : { changeLayoutCollapsed ( state , { payload } ) { return { ... initState , ... state , collapsed : payload , } ; } , setTopNavEnable ( state , { payload } ) { return { ... initState , ... state , topNavEnable : payload , } ; } , setHeadFixed ( state , { payload } ) { return { ... initState , ... state , headFixed : payload , } ; } , } , } ; export default GlobalModel ;