gengitkan/client/src/store/sagas/failure.ts

12 lines
342 B
TypeScript
Raw Normal View History

2019-12-01 22:12:13 +01:00
import { GiteaUnauthorizedError } from "../../util/gitea";
import { put } from 'redux-saga/effects';
2019-12-13 15:48:58 +01:00
import { logout } from '../actions/logout';
import { saveReferer } from "../../util/referer";
2019-11-28 14:12:48 +01:00
2019-12-01 22:12:13 +01:00
export function* failuresSaga(action) {
2020-05-06 11:30:26 +02:00
if (action.error instanceof GiteaUnauthorizedError) {
saveReferer();
2019-12-13 14:21:20 +01:00
yield put(logout());
2019-12-01 22:12:13 +01:00
}
2019-11-28 14:12:48 +01:00
}