frontend/src/routes/list/mobile-games/+page.server.ts
2025-01-18 19:54:37 +01:00

25 lines
593 B
TypeScript

export const load = async ({ locals }) => {
const getData = async () => {
const { apiKey, apiURL } = locals;
const postData = {'filterList': 'mobile-games'}
// make the POST request to the endpoint
const response = await fetch(apiURL + "/list-category", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": apiKey,
},
body: JSON.stringify(postData)
});
const output = await response.json();
return output;
};
// Make sure to return a promise
return {
getData: await getData(),
};
};