2019-12-13 13:30:33 +01:00
|
|
|
import { call, put } from 'redux-saga/effects';
|
|
|
|
import { LOGOUT_FAILURE, LOGOUT_SUCCESS } from '../actions/logout';
|
|
|
|
|
2019-12-01 22:12:13 +01:00
|
|
|
export function* logoutSaga() {
|
2019-12-13 13:30:33 +01:00
|
|
|
try {
|
|
|
|
yield call(fetch, '/logout', { mode: 'no-cors', credentials: 'include' });
|
|
|
|
} catch(err) {
|
|
|
|
yield put({ type: LOGOUT_FAILURE, error: err });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yield put({ type: LOGOUT_SUCCESS });
|
|
|
|
}
|
|
|
|
|
|
|
|
export function* logoutSuccessSaga() {
|
|
|
|
window.location.reload();
|
2019-12-01 22:12:13 +01:00
|
|
|
}
|