(request: FetchRequest)
| 108 | * Fetch function for searches using TanStack Query |
| 109 | */ |
| 110 | const fetchRequest = async (request: FetchRequest): Promise<SearchResponse> => { |
| 111 | if (!stacApi) throw new Error('No STAC API configured'); |
| 112 | |
| 113 | const response = |
| 114 | request.type === 'search' |
| 115 | ? await stacApi.search(request.payload, request.headers) |
| 116 | : await stacApi.get(request.url); |
| 117 | |
| 118 | return handleStacResponse<SearchResponse>(response); |
| 119 | }; |
| 120 | |
| 121 | /** |
| 122 | * useQuery for search and pagination with caching |
no test coverage detected