import { createReducer } from '@reduxjs/toolkit' ; import type { ActionHandler } from '@core' ; import { setRunningAction , setOnlineAction } from './actions' ; import { SetOnlineActionPayload , SetRunningActionPayload } from './types' ; interface AppState { running : boolean ; online : boolean ; } const initialState = { running : false , online : false , } ; const handleSetRunning = ( state , { payload } ) => ( { ... state , running : payload . running , } ) ; const handleSetOnline = ( state , { payload } ) => ( { ... state , online : payload . online , } ) ; const appReducer = createReducer ( initialState , { [ setRunningAction . type ] : handleSetRunning , [ setOnlineAction . type ] : handleSetOnline , } ) ; export default appReducer ;