| @@ -160,55 +160,39 @@ export const SetupAxiosInterceptors = () => { | |||||
| throw refreshError; | throw refreshError; | ||||
| }); | }); | ||||
| } else { | } else { | ||||
| if (isUserLoggedIn()){ | |||||
| if (error.response.status === 401) { | |||||
| if (localStorage.getItem("expiredAlertShown") === null) { | |||||
| localStorage.setItem("expiredAlertShown", true) | |||||
| alert("登入驗證已過期,請重新登入。") | |||||
| } | |||||
| } | |||||
| // ** if (status === 401) { | |||||
| // if (response.status === 401) { | |||||
| // if (localStorage.getItem("expiredAlertShown") === null) { | |||||
| // localStorage.setItem("expiredAlertShown", true) | |||||
| // alert("登入驗證已過期,請重新登入。") | |||||
| // } | |||||
| // } | |||||
| // if (response && response.status === 401) { | |||||
| // if (localStorage.getItem("expiredAlertShown") === null) { | |||||
| // localStorage.setItem("expiredAlertShown", true) | |||||
| // alert("登入驗證已過期,請重新登入。") | |||||
| // } | |||||
| // } | |||||
| if (error.response.status === 500) { | |||||
| // await dispatch(handleLogoutFunction()); | |||||
| // await navigate('/login'); | |||||
| // await window.location.reload(); | |||||
| } | |||||
| if (localStorage.getItem("expiredAlertShown")) { | |||||
| await dispatch(handleLogoutFunction()); | |||||
| await navigate('/login'); | |||||
| await window.location.reload(); | |||||
| } | |||||
| // console.log(error) | |||||
| } else { | |||||
| if (error.response.status === 401) { | |||||
| await dispatch(handleLogoutFunction()); | |||||
| await navigate('/login'); | |||||
| // await window.location.reload(); | |||||
| } | |||||
| if (error.response.status === 401) { | |||||
| await dispatch(handleLogoutFunction()); | |||||
| await navigate('/login'); | |||||
| await window.location.reload(); | |||||
| } | } | ||||
| // ** if (status === 401) { | |||||
| // if (response.status === 401) { | |||||
| // if (localStorage.getItem("expiredAlertShown") === null) { | |||||
| // localStorage.setItem("expiredAlertShown", true) | |||||
| // alert("登入驗證已過期,請重新登入。") | |||||
| // } | |||||
| // } | |||||
| // if (response && response.status === 401) { | |||||
| // if (localStorage.getItem("expiredAlertShown") === null) { | |||||
| // localStorage.setItem("expiredAlertShown", true) | |||||
| // alert("登入驗證已過期,請重新登入。") | |||||
| // } | |||||
| // } | |||||
| // if (localStorage.getItem("expiredAlertShown")) { | |||||
| // await dispatch(handleLogoutFunction()); | |||||
| // await navigate('/login'); | |||||
| // await window.location.reload(); | |||||
| // } | |||||
| if (error.response.status === 500){ | |||||
| //setIsUploading(false); | |||||
| } | |||||
| // console.log(error) | |||||
| } | } | ||||
| return Promise.reject(error) | return Promise.reject(error) | ||||
| } | } | ||||