import { ActionType , State } from '../ducks' ; const SET_ONLINE = 'SET_ONLINE' ; interface SetOnlineAction { payload : boolean ; type : typeof SET_ONLINE ; } export type OnlineActionType = SetOnlineAction ; export const setOnline = ( state ) : SetOnlineAction => ( { payload : state , type : SET_ONLINE , } ) ; export type OnlineState = boolean ; export default ( state = false , action ) => { switch ( action . type ) { case SET_ONLINE : return action . payload ; default : return state ; } } ; export const getOnline = ( state ) => state . online ;