hongbo-miao/hongbomiao.com

View on GitHub
web/src/health/reducers/healthReducer.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Reducer } from 'redux';
import HealthActionType from '../actionTypes/HealthActionType';
import HealthState from '../types/HealthState';

const initialState: HealthState = {};

// eslint-disable-next-line default-param-last
const healthReducer: Reducer = (state = initialState, action) => {
  switch (action.type) {
    case HealthActionType.RECEIVE_PING_SUCCEED: {
      const { res } = action.payload;
      return {
        ...state,
        ping: res.data.ping,
      };
    }

    default: {
      return state;
    }
  }
};

export default healthReducer;