Mobile Work
This commit is contained in:
@@ -23,6 +23,15 @@ export const useVehicles = () => {
|
||||
queryKey: ['vehicles'],
|
||||
queryFn: vehiclesApi.getAll,
|
||||
enabled: isAuthenticated && !isLoading,
|
||||
retry: (failureCount, error: any) => {
|
||||
// Retry 401 errors up to 3 times for mobile auth timing issues
|
||||
if (error?.response?.status === 401 && failureCount < 3) {
|
||||
console.log(`[Mobile Auth] API retry ${failureCount + 1}/3 for 401 error`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30000),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -32,6 +41,15 @@ export const useVehicle = (id: string) => {
|
||||
queryKey: ['vehicles', id],
|
||||
queryFn: () => vehiclesApi.getById(id),
|
||||
enabled: !!id && isAuthenticated && !isLoading,
|
||||
retry: (failureCount, error: any) => {
|
||||
// Retry 401 errors up to 3 times for mobile auth timing issues
|
||||
if (error?.response?.status === 401 && failureCount < 3) {
|
||||
console.log(`[Mobile Auth] API retry ${failureCount + 1}/3 for 401 error`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30000),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user