feat: redesign dashboard around place search
This commit is contained in:
9
lib/location-api.ts
Normal file
9
lib/location-api.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { Language } from "@/lib/i18n";
|
||||
import type { LocationSearchResult } from "@/types/location";
|
||||
|
||||
export async function fetchLocations(query: string, language: Language, signal?: AbortSignal): Promise<LocationSearchResult[]> {
|
||||
const params = new URLSearchParams({ query, language });
|
||||
const response = await fetch(`/api/locations/search?${params}`, { signal });
|
||||
if (!response.ok) throw new Error("Location search is temporarily unavailable.");
|
||||
return response.json() as Promise<LocationSearchResult[]>;
|
||||
}
|
||||
Reference in New Issue
Block a user