Files
2026-05-31 18:00:43 +03:30

54 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { QueryClientConfig } from "@tanstack/react-query";
export const queryClientOptionsData: QueryClientConfig = {
defaultOptions: {
queries: {
// مدت زمانی که داده fresh حساب می‌شود
staleTime: 1000 * 60 * 5, // 5 دقیقه
// مدت نگهداری کش در حافظه بعد از unmount
gcTime: 1000 * 60 * 30, // 30 دقیقه
// چند بار در صورت خطا retry کند
retry: (failureCount: any, error: any) => {
// برای خطاهای 4xx معمولاً retry منطقی نیست
const status = error?.response?.status;
if (status >= 400 && status < 500) return false;
return failureCount < 2;
},
// تاخیر بین retryها
retryDelay: (attemptIndex: any) =>
Math.min(1000 * 2 ** attemptIndex, 10000),
// جلوگیری از رفرش‌های اضافه
refetchOnWindowFocus: false,
refetchOnReconnect: true,
refetchOnMount: false,
},
mutations: {
retry: 0,
},
},
};
export const genderOptions = [
{
id: 1,
label: "مرد",
value: "male",
},
{
id: 2,
label: "زن",
value: "female",
},
{
id: 3,
label: "ساير",
value: "other",
},
];
export const religionOptions = ["اسلام", "مسیحیت", "یهودیت", "زرتشتی", "سایر"];