serverInfo.ts 570 Bytes
Newer Older
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import update from 'immutability-helper';

// Model
import SsrError from '@gringlobal/client/model/common/SsrError';

import { RECEIVE_SSR_ERROR_INFO } from 'core/constants/serverInfo';

const INITIAL_STATE: {
  ssrError: SsrError,
} = {
  ssrError: null,
};

export default (state = INITIAL_STATE, action: { type?: string, payload?: any } = { type: '', payload: {} }) => {

  switch (action.type) {
    case RECEIVE_SSR_ERROR_INFO: {
      return update(state, {
        ssrError: { $set: action.payload.error },
      });
    }

    default:
      return state;
  }
}