dasdasd
This commit is contained in:
53
core/constant/index.ts
Normal file
53
core/constant/index.ts
Normal 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 = ["اسلام", "مسیحیت", "یهودیت", "زرتشتی", "سایر"];
|
||||
Reference in New Issue
Block a user