fix(admin-panel): add RTL direction to Toaster and skip refresh when unauthenticated
Deploy Canina / deploy (push) Failing after 29s
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
1 parent
90ecf39295
commit
713a714dd2
2 files changed
+21
-10
No files matched your search
@@ -17,7 +17,16 @@ function SuspenseFallback() {
|
||||
function App() {
|
||||
return (
|
||||
<>
|
||||
<Toaster position="top-center" toastOptions={{ className: 'font-vazir' }} />
|
||||
<Toaster
|
||||
position="top-center"
|
||||
toastOptions={{
|
||||
className: 'font-vazir text-sm font-bold',
|
||||
style: {
|
||||
direction: 'rtl',
|
||||
fontFamily: 'Vazirmatn, system-ui, sans-serif'
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Suspense fallback={<SuspenseFallback />}>
|
||||
<RouterProvider router={router} />
|
||||
</Suspense>
|
||||
|
||||
@@ -17,17 +17,19 @@ export default function ProtectedRoute() {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await api.post<ApiResponse<AuthResponseData>>('/auth/refresh');
|
||||
if (response.data?.success && response.data.data?.accessToken) {
|
||||
if (isMounted) {
|
||||
setAuth(response.data.data.accessToken, response.data.data.user);
|
||||
setIsValidating(false);
|
||||
if (accessToken) {
|
||||
try {
|
||||
const response = await api.post<ApiResponse<AuthResponseData>>('/auth/refresh');
|
||||
if (response.data?.success && response.data.data?.accessToken) {
|
||||
if (isMounted) {
|
||||
setAuth(response.data.data.accessToken, response.data.data.user);
|
||||
setIsValidating(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
} catch {
|
||||
// Token invalid or refresh failed
|
||||
}
|
||||
} catch {
|
||||
// Fallback profile check if token already in memory
|
||||
}
|
||||
|
||||
if (accessToken) {
|
||||
|
||||
Reference in new issue
Block a user