frontend/src/routes/list/most-employees/+page.server.ts
2024-11-24 16:36:20 +01:00

27 lines
627 B
TypeScript

export const load = async ({ locals, setHeaders }) => {
const getData = async () => {
const { apiKey, apiURL } = locals;
const postData = { filterList: 'most-employees' };
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();
setHeaders({ "cache-control": "public, max-age=60*5" });
return output;
};
// Make sure to return a promise
return {
getData: await getData(),
};
};