Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

queries.ts

11 lines360 Bytes

1import { queryOptions } from '@tanstack/react-query'
2import { locationsAPI } from './api'
3​
4export const locationsQueries = {
5 all: () => ['locations'] as const,
6 detail: (locationId: string) =>
7 queryOptions({
8 queryKey: [...locationsQueries.all(), 'detail', locationId] as const,
9 queryFn: () => locationsAPI.getLocation(locationId),
10 }),