fix(ui): fix method context

This commit is contained in:
sylenien 2023-01-06 17:48:39 +01:00
parent ed954dea94
commit a94d5f4904
2 changed files with 5 additions and 2 deletions

View file

@ -1,6 +1,6 @@
import logger from 'App/logger';
import APIClient from './api_client';
import { UPDATE_JWT } from './duck/user';
import { LOGIN, UPDATE_JWT } from './duck/user';
export default () => (next) => (action) => {
const { types, call, ...rest } = action;
@ -14,7 +14,7 @@ export default () => (next) => (action) => {
return call(client)
.then(async (response) => {
if (response.status === 403) {
next({ type: UPDATE_JWT, data: null });
next({ type: LOGIN.FAILURE, data: null });
}
if (!response.ok) {
const text = await response.text();

View file

@ -6,6 +6,9 @@ import apiMiddleware from './api_middleware';
import LocalStorage from './local_storage';
import { initialState as initUserState, UPDATE_JWT } from './duck/user'
// TODO @remove after few days
localStorage.removeItem('jwt')
const storage = new LocalStorage({
user: Object,
});