casey-chow/tigertrade

View on GitHub
client/src/middleware/errorHandling.js

Summary

Maintainability
A
0 mins
Test Coverage
import { loadCurrentUser } from '../actions/users';

// Reload the current user if an error occurs.
// eslint-disable-next-line import/prefer-default-export
export const checkLoggedInIfError = store => next => (action) => {
  if (action.err && action.type !== 'LOAD_CURRENT_USER_FAILURE') {
    store.dispatch(loadCurrentUser());
  }

  return next(action);
};