mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
fix: Fix logging out with invalid token
This commit is contained in:
parent
6a09e9a984
commit
4e7e57dfd9
4 changed files with 16 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
||||||
import ActionTypes from '../constants/ActionTypes';
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
const initializeCore = (
|
const initializeCore = (
|
||||||
config,
|
|
||||||
user,
|
user,
|
||||||
board,
|
board,
|
||||||
users,
|
users,
|
||||||
|
@ -21,7 +20,6 @@ const initializeCore = (
|
||||||
) => ({
|
) => ({
|
||||||
type: ActionTypes.CORE_INITIALIZE,
|
type: ActionTypes.CORE_INITIALIZE,
|
||||||
payload: {
|
payload: {
|
||||||
config,
|
|
||||||
user,
|
user,
|
||||||
board,
|
board,
|
||||||
users,
|
users,
|
||||||
|
@ -41,6 +39,14 @@ const initializeCore = (
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: with success?
|
||||||
|
initializeCore.fetchConfig = (config) => ({
|
||||||
|
type: ActionTypes.CORE_INITIALIZE__CONFIG_FETCH,
|
||||||
|
payload: {
|
||||||
|
config,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const logout = () => ({
|
const logout = () => ({
|
||||||
type: ActionTypes.LOGOUT,
|
type: ActionTypes.LOGOUT,
|
||||||
payload: {},
|
payload: {},
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default {
|
||||||
/* Core */
|
/* Core */
|
||||||
|
|
||||||
CORE_INITIALIZE: 'CORE_INITIALIZE',
|
CORE_INITIALIZE: 'CORE_INITIALIZE',
|
||||||
|
CORE_INITIALIZE__CONFIG_FETCH: 'CORE_INITIALIZE__CONFIG_FETCH',
|
||||||
LOGOUT: 'LOGOUT',
|
LOGOUT: 'LOGOUT',
|
||||||
LOGOUT__ACCESS_TOKEN_INVALIDATE: 'LOGOUT__ACCESS_TOKEN_INVALIDATE',
|
LOGOUT__ACCESS_TOKEN_INVALIDATE: 'LOGOUT__ACCESS_TOKEN_INVALIDATE',
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,11 @@ export default (state = initialState, { type, payload }) => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
isInitializing: false,
|
isInitializing: false,
|
||||||
...(payload.config && {
|
};
|
||||||
config: payload.config,
|
case ActionTypes.CORE_INITIALIZE__CONFIG_FETCH:
|
||||||
}),
|
return {
|
||||||
|
...state,
|
||||||
|
config: payload.config,
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|
|
@ -14,6 +14,8 @@ export function* initializeCore() {
|
||||||
let config;
|
let config;
|
||||||
if (!currentConfig) {
|
if (!currentConfig) {
|
||||||
({ item: config } = yield call(api.getConfig)); // TODO: handle error
|
({ item: config } = yield call(api.getConfig)); // TODO: handle error
|
||||||
|
|
||||||
|
yield put(actions.initializeCore.fetchConfig(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -40,7 +42,6 @@ export function* initializeCore() {
|
||||||
|
|
||||||
yield put(
|
yield put(
|
||||||
actions.initializeCore(
|
actions.initializeCore(
|
||||||
config,
|
|
||||||
user,
|
user,
|
||||||
board,
|
board,
|
||||||
users,
|
users,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue