17 lines
433 B
TypeScript
17 lines
433 B
TypeScript
|
import { call, put } from 'redux-saga/effects';
|
||
|
import { LOGOUT_FAILURE, LOGOUT_SUCCESS } from '../actions/logout';
|
||
|
|
||
|
export function* logoutSaga() {
|
||
|
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();
|
||
|
}
|