Handle data loading during SSR
This commit is contained in:
10
front/src/routes/+page.server.ts
Normal file
10
front/src/routes/+page.server.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
const api_url = import.meta.env.VITE_SERVER_API_URL
|
||||
|
||||
// @ts-ignore
|
||||
export const load = async ( {fetch} ) => {
|
||||
|
||||
const res = await fetch(`${api_url}/leaderboard`)
|
||||
const leaderboard = await res.json()
|
||||
|
||||
return { leaderboard };
|
||||
}
|
||||
Reference in New Issue
Block a user