mirror of
https://github.com/plankanban/planka.git
synced 2025-12-19 09:13:20 +03:00
feat: Store accessToken in cookies instead of localStorage
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { call, fork, join, put, select, take } from 'redux-saga/effects';
|
||||
import { call, fork, join, put, take } from 'redux-saga/effects';
|
||||
|
||||
import { accessTokenSelector } from '../../selectors';
|
||||
import { logout } from '../../actions';
|
||||
import ErrorCodes from '../../constants/ErrorCodes';
|
||||
|
||||
@@ -13,12 +12,8 @@ function* queueRequest(method, ...args) {
|
||||
} catch {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
||||
const accessToken = yield select(accessTokenSelector);
|
||||
|
||||
try {
|
||||
return yield call(method, ...args, {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
});
|
||||
return yield call(method, ...args);
|
||||
} catch (error) {
|
||||
if (error.code === ErrorCodes.UNAUTHORIZED) {
|
||||
yield put(logout()); // TODO: next url
|
||||
|
||||
Reference in New Issue
Block a user