|
|
|
@@ -45,6 +45,8 @@ export const handleLogin = data => { |
|
|
|
localStorage.setItem(windowCount, '0') |
|
|
|
localStorage.setItem(predictProductionQty, '0') |
|
|
|
localStorage.setItem(predictUsageCount, '0') |
|
|
|
localStorage.removeItem('expiredAlertShown') |
|
|
|
expiredAlertShownInMemory = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -100,8 +102,9 @@ export const handleLogoutFunction = () => { |
|
|
|
localStorage.removeItem('transactionid') |
|
|
|
localStorage.removeItem('searchCriteria') |
|
|
|
//localStorage.removeItem(config.storageUserRoleKeyName) |
|
|
|
localStorage.removeItem('expiredAlertShown'); |
|
|
|
expiredAlertShownInMemory = false; |
|
|
|
// Do not clear expiredAlertShown / expiredAlertShownInMemory here: logout runs right after |
|
|
|
// the token-expired alert, and parallel 401s would each show another popup if we reset. |
|
|
|
// Reset those only on successful login (handleLogin). |
|
|
|
localStorage.removeItem(refreshIntervalName) |
|
|
|
localStorage.removeItem(windowCount) |
|
|
|
localStorage.removeItem(predictProductionQty) |
|
|
|
@@ -147,7 +150,8 @@ export const SetupAxiosInterceptors = () => { |
|
|
|
}, |
|
|
|
async (error) => { |
|
|
|
// const { config, response: { status } } = error |
|
|
|
if (error.response.status === 401 && error.config.url !== apiPath + REFRESH_TOKEN) { |
|
|
|
const status = error.response?.status |
|
|
|
if (status === 401 && error.config?.url !== apiPath + REFRESH_TOKEN) { |
|
|
|
// Make a request to refresh the access token |
|
|
|
const refreshToken = localStorage.getItem('refreshToken'); |
|
|
|
if (isRefreshToken) { |
|
|
|
@@ -210,7 +214,7 @@ export const SetupAxiosInterceptors = () => { |
|
|
|
await window.location.reload(); |
|
|
|
} |
|
|
|
|
|
|
|
if (error.response.status === 500){ |
|
|
|
if (error.response?.status === 500){ |
|
|
|
//setIsUploading(false); |
|
|
|
} |
|
|
|
// console.log(error) |
|
|
|
|