frontend/src/routes/market-mover/afterhours/gainers/+layout.server.ts
MuslemRahimi d822ca8ed2 ui fix
2025-03-07 01:16:05 +01:00

26 lines
675 B
TypeScript

export const load = async ({ locals }) => {
const { apiURL, apiKey, user } = locals;
const getMarketMover = async () => {
const postData = { category: "afterhours", params: 'gainers' };
const response = await fetch(apiURL + "/pre-after-market-movers", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": apiKey,
},
body: JSON.stringify(postData),
});
let output = await response.json();
output = !["Pro", "Plus"]?.includes(user?.tier) ? output?.slice(0, 5) : output;
return output;
};
return {
getMarketMover: await getMarketMover(),
};
};