api: update key to api

This commit is contained in:
Cron1cle
2025-10-17 11:53:45 +02:00
parent 38ac309925
commit ceb7b86462
7 changed files with 55 additions and 20 deletions

View File

@@ -32,8 +32,15 @@ const SHOW_API_URL = "http://45.157.177.99:8080/shows";
export async function getShows(): Promise<Show[]> {
try {
const response = await fetch(SHOW_API_URL);
const apiKey = process.env.EXPO_PUBLIC_API_KEY;
const response = await fetch(SHOW_API_URL, {
headers: {
"Content-Type": "application/json",
"X-API-Key": apiKey ?? "",
},
});
if (!response.ok) {
console.error("Fetch error:", response);
throw new Error("Network response was not ok");
}
const data: unknown = await response.json();
@@ -52,8 +59,6 @@ export async function getShows(): Promise<Show[]> {
concept: s.concept,
running: s.running,
logoUri: s.logoUrl ?? "",
startDate: s.startDate,
endDate: s.endDate,
}));
} catch (error) {
console.error("Fetch error:", error);

View File

@@ -8,7 +8,13 @@ const STREAMING_SERVICE_API_URL = "http://45.157.177.99:8080/config";
export async function getStreamingImages(): Promise<StreamingServiceRaw[]> {
try {
const response = await fetch(STREAMING_SERVICE_API_URL);
const apiKey = process.env.EXPO_PUBLIC_API_KEY;
const response = await fetch(STREAMING_SERVICE_API_URL, {
headers: {
"Content-Type": "application/json",
"X-API-Key": apiKey ?? "",
},
});
if (!response.ok) {
throw new Error("Network response was not ok");
}