api: reconfigered api handling

This commit is contained in:
Yordan Simeonov
2025-10-20 18:45:01 +02:00
parent d0194f0dc2
commit 98a2067b8d
9 changed files with 112 additions and 295 deletions

View File

@@ -20,7 +20,8 @@ export async function getSearchResults(
filteredTags.join(",")
)}&limit=${limit}`;
const res = await fetch(url, { signal });
const apiKey = process.env.EXPO_PUBLIC_API_KEY;
const res = await fetch(url, { signal, headers: { 'Content-Type': 'application/json', "X-API-Key": apiKey ?? "", } });
if (!res.ok) throw new Error("AutoComplete failed " + res.status);
const data: unknown = await res.json();