fix(ui) - check for error status and force logout (#1179)
* fix(ui) - token expire * fix(ui) - token expire
This commit is contained in:
parent
c0e9205780
commit
d406c720b8
1 changed files with 7 additions and 3 deletions
|
|
@ -13,9 +13,9 @@ export default () => (next) => (action) => {
|
|||
|
||||
return call(client)
|
||||
.then(async (response) => {
|
||||
if (response.status === 403) {
|
||||
next({ type: FETCH_ACCOUNT.FAILURE });
|
||||
}
|
||||
// if (response.status === 403) {
|
||||
// next({ type: FETCH_ACCOUNT.FAILURE });
|
||||
// }
|
||||
if (!response.ok) {
|
||||
const text = await response.text();
|
||||
return Promise.reject(text);
|
||||
|
|
@ -34,6 +34,10 @@ export default () => (next) => (action) => {
|
|||
}
|
||||
})
|
||||
.catch(async (e) => {
|
||||
if (e.response?.status === 403) {
|
||||
next({ type: FETCH_ACCOUNT.FAILURE });
|
||||
}
|
||||
|
||||
const data = await e.response?.json();
|
||||
logger.error('Error during API request. ', e);
|
||||
return next({ type: FAILURE, errors: data ? parseError(data.errors) : [] });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue