This commit is contained in:
2026-05-31 18:00:43 +03:30
parent 98af7d639b
commit b241d12ff5
20 changed files with 939 additions and 797 deletions

53
core/constant/index.ts Normal file
View File

@@ -0,0 +1,53 @@
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 = ["اسلام", "مسیحیت", "یهودیت", "زرتشتی", "سایر"];