frontend/src/routes/etf/[tickerID]/options/gex/strike/+page.server.ts
2025-01-08 13:42:50 +01:00

36 lines
644 B
TypeScript

export const load = async ({ locals, params }) => {
const { apiKey, apiURL, user } = locals;
const getData = async () => {
const postData = {
params: params.tickerID,
category: "strike"
};
const response = await fetch(apiURL + "/options-gex-dex", {
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(),
};
};