api: update key to api
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user