fix(api/auth): allow public GET on ui-texts & scientific-terms, fix refresh attempt loop, remove duplicate error toasts and prevent unwanted modal popups
Deploy Canina / deploy (push) Failing after 28s
Deploy Canina / deploy (push) Failing after 28s
This commit is contained in:
1 parent
adbfa60343
commit
74b3d24622
6 files changed
+48
-10
No files matched your search
@@ -33,7 +33,7 @@ export default function Login() {
|
||||
toast.error('اطلاعات ورود نامعتبر است');
|
||||
}
|
||||
} catch {
|
||||
toast.error('ایمیل یا رمز عبور اشتباه است');
|
||||
// Toast notification is handled by api.ts interceptor
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ api.interceptors.response.use(
|
||||
const farsiMessage = responseData?.message || 'خطایی در ارتباط با سرور رخ داده است.';
|
||||
|
||||
if (status === 401 && originalRequest && !originalRequest._retry) {
|
||||
if (originalRequest.url?.includes('/auth/refresh') || originalRequest.url?.includes('/auth/admin-login') || originalRequest.url?.includes('/auth/verify-otp')) {
|
||||
const currentToken = useAdminAuthStore.getState().accessToken;
|
||||
if (!currentToken || originalRequest.url?.includes('/auth/refresh') || originalRequest.url?.includes('/auth/admin-login') || originalRequest.url?.includes('/auth/verify-otp')) {
|
||||
useAdminAuthStore.getState().clearAuth();
|
||||
if (window.location.pathname !== '/login') {
|
||||
toast.error('نشست کاری شما منقضی شده است. لطفاً مجدداً وارد شوید.');
|
||||
|
||||
Reference in new issue
Block a user