admin-on-rest-fr05t1k
Version:
A frontend Framework for building admin applications on top of REST services, using ES6, React and Material UI
14 lines (12 loc) • 500 B
JavaScript
import { put, takeEvery } from 'redux-saga/effects';
import { push } from 'react-router-redux';
import { FETCH_ERROR } from '../../actions/fetchActions';
import { hideNotification } from '../../actions/notificationActions';
export default function* () {
yield takeEvery(FETCH_ERROR, function* redirectIfNotauthenticated({ error }) {
if (error.status === 401 || error.status === 403) {
yield put(hideNotification());
yield put(push('/login'));
}
});
}