refactor: 💡 types

This commit is contained in:
amianthus
2025-09-16 13:52:35 +01:00
parent d6e9802cdc
commit d529d6adb7
3 changed files with 70 additions and 69 deletions

View File

@@ -1,6 +1,6 @@
import { useAxiosInstance } from "@/services/useAxiosInstance";
import { Feature } from "@autumn/shared";
import type { Feature } from "@autumn/shared";
import { useQuery } from "@tanstack/react-query";
import { useAxiosInstance } from "@/services/useAxiosInstance";
export const useFeaturesQuery = () => {
const axiosInstance = useAxiosInstance();
@@ -17,5 +17,5 @@ export const useFeaturesQuery = () => {
queryFn: fetchFeatures,
});
return { features: data?.features || [], isLoading, error, refetch };
return { features: (data?.features || []) as Feature[], isLoading, error, refetch };
};

View File

@@ -1,6 +1,6 @@
import { useAxiosInstance } from "@/services/useAxiosInstance";
import { FullProduct, ProductCounts, ProductV2 } from "@autumn/shared";
import type { FullProduct, ProductCounts, ProductV2 } from "@autumn/shared";
import { useQuery } from "@tanstack/react-query";
import { useAxiosInstance } from "@/services/useAxiosInstance";
export const useProductsQuery = () => {
const axiosInstance = useAxiosInstance();
@@ -31,7 +31,7 @@ export const useProductsQuery = () => {
});
return {
products: data?.products || [],
products: (data?.products || []) as ProductV2[],
counts: countsData || {},
groupToDefaults: data?.groupToDefaults || {},
isLoading,

View File

@@ -1,5 +1,6 @@
import { useAxiosInstance } from "@/services/useAxiosInstance";
import type { Reward, RewardProgram } from "@autumn/shared";
import { useQuery } from "@tanstack/react-query";
import { useAxiosInstance } from "@/services/useAxiosInstance";
export const useRewardsQuery = () => {
const axiosInstance = useAxiosInstance();
@@ -15,8 +16,8 @@ export const useRewardsQuery = () => {
});
return {
rewards: data?.rewards || [],
rewardPrograms: data?.rewardPrograms || [],
rewards: (data?.rewards || []) as Reward[],
rewardPrograms: (data?.rewardPrograms || []) as RewardProgram[],
isLoading,
error,
refetch,