summaryrefslogtreecommitdiff
path: root/frontend/src/redux/errors.js
blob: ad1e27959b6e7c395ab063ac2a9c4cbe2c427410 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import ErrorsState from '../models/errors';

export const types = {
  ERROR_RECEIVED_ON_WS: 'ERROR/RECEIVED_ON_WS',
};

export const actions = {
  errorReceived: error => ({
    type: types.ERROR_RECEIVED_ON_WS,
    error,
  }),
};

export default (state = new ErrorsState(), action) => {
  switch (action.type) {
    case types.ERROR_RECEIVED_ON_WS:
      return state.addError(action.error);
    default:
      return state;
  }
};
bgstack15