Adopt TanStack Query
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 13m46s

This commit is contained in:
2026-01-10 10:43:13 -08:00
parent 6d468544e2
commit dcd9452b8c
31 changed files with 584 additions and 157 deletions

View File

@@ -1,6 +1,7 @@
// src/hooks/queries/useFlyerItemsQuery.ts
import { useQuery } from '@tanstack/react-query';
import * as apiClient from '../../services/apiClient';
import { queryKeys } from '../../config/queryKeys';
import type { FlyerItem } from '../../types';
/**
@@ -19,7 +20,7 @@ import type { FlyerItem } from '../../types';
*/
export const useFlyerItemsQuery = (flyerId: number | undefined) => {
return useQuery({
queryKey: ['flyer-items', flyerId],
queryKey: queryKeys.flyerItems(flyerId as number),
queryFn: async (): Promise<FlyerItem[]> => {
if (!flyerId) {
throw new Error('Flyer ID is required');