style: clean up code formatting and remove trailing whitespace
refactor: reorganize imports and fix type imports
This commit is contained in:
1 parent
d3704602fd
commit
47c04de6fe
232 files changed
+7140
-4798
No files matched your search
@@ -68,29 +68,33 @@ export function useMyPurchaseIntentions() {
|
||||
const queryParams = new URLSearchParams();
|
||||
queryParams.set("limit", "100");
|
||||
|
||||
const { data, isLoading, error, refetch } = useQuery<PurchaseIntentionsResponse>({
|
||||
queryKey: ["my-purchase-intentions"],
|
||||
queryFn: async () => {
|
||||
const res = await fetch(`/api/purchase-intentions/my?${queryParams.toString()}`);
|
||||
if (!res.ok) {
|
||||
if (res.status === 401) {
|
||||
throw new Error("Não autenticado");
|
||||
const { data, isLoading, error, refetch } =
|
||||
useQuery<PurchaseIntentionsResponse>({
|
||||
queryKey: ["my-purchase-intentions"],
|
||||
queryFn: async () => {
|
||||
const res = await fetch(
|
||||
`/api/purchase-intentions/my?${queryParams.toString()}`,
|
||||
);
|
||||
if (!res.ok) {
|
||||
if (res.status === 401) {
|
||||
throw new Error("Não autenticado");
|
||||
}
|
||||
throw new Error("Erro ao buscar intenções de compra");
|
||||
}
|
||||
throw new Error("Erro ao buscar intenções de compra");
|
||||
}
|
||||
return res.json();
|
||||
},
|
||||
staleTime: 1000 * 30, // 30 segundos
|
||||
refetchInterval: 1000 * 30, // Refetch a cada 30 segundos
|
||||
refetchOnWindowFocus: true,
|
||||
refetchOnReconnect: true,
|
||||
enabled: true, // Sempre habilitado (autenticação é verificada no backend)
|
||||
});
|
||||
return res.json();
|
||||
},
|
||||
staleTime: 1000 * 30, // 30 segundos
|
||||
refetchInterval: 1000 * 30, // Refetch a cada 30 segundos
|
||||
refetchOnWindowFocus: true,
|
||||
refetchOnReconnect: true,
|
||||
enabled: true, // Sempre habilitado (autenticação é verificada no backend)
|
||||
});
|
||||
|
||||
const normalizedIntentions = (data?.intentions || []).map((intention) => ({
|
||||
...intention,
|
||||
custom_offer_amount:
|
||||
intention.custom_offer_amount !== null && intention.custom_offer_amount !== undefined
|
||||
intention.custom_offer_amount !== null &&
|
||||
intention.custom_offer_amount !== undefined
|
||||
? Number(intention.custom_offer_amount)
|
||||
: null,
|
||||
}));
|
||||
@@ -116,4 +120,3 @@ export function useInvalidatePurchaseIntentions() {
|
||||
|
||||
return invalidate;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user