nukeop/nuclear

View on GitHub
packages/app/app/reducers/connectivity.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { ActionType, getType } from 'typesafe-actions';
import * as ConnectivityActions from '../actions/connectivity';

type ConnectivityReducerActions = ActionType<typeof ConnectivityActions>

const ConnectivityReducer = (state = navigator.onLine, action: ConnectivityReducerActions): boolean => {
  switch (action.type) {
  case getType(ConnectivityActions.changeConnectivity):
    return action.payload;
  default:
    return state;
  }
};

export default ConnectivityReducer;