frontend/src/routes/list/exchange/[slug]/+page.server.ts
2024-11-12 17:52:38 +01:00

29 lines
717 B
TypeScript

export const load = async ({ locals, params }) => {
const getParams = async () => {
return params.slug;
};
const getExchangeCategory = async () => {
const { apiKey, apiURL } = locals;
const postData = { filterList: params.slug };
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 {
getExchangeCategory: await getExchangeCategory(),
getParams: await getParams(),
};
};