13 lines
456 B
JavaScript
13 lines
456 B
JavaScript
import { put } from 'redux-saga/effects';
|
|
import { UnauthorizedError } from '../errors/unauthorized.error.js';
|
|
import { addMessage } from '../actions/message.actions.js';
|
|
import { logout } from '../actions/auth.actions.js';
|
|
|
|
export function* failureActionSaga({ error }) {
|
|
console.error(error);
|
|
if (error instanceof UnauthorizedError) {
|
|
yield put(addMessage('danger', 'Vous avez été déconnecté.'));
|
|
yield put(logout());
|
|
}
|
|
}
|