Files
Lazuli/src/routes/(app)/+page.server.ts

14 lines
591 B
TypeScript
Raw Normal View History

2024-02-04 01:01:37 -05:00
import { SECRET_INTERNAL_API_KEY } from '$env/static/private'
import type { PageServerLoad } from './$types'
2024-02-08 21:47:54 -05:00
export const load: PageServerLoad = async ({ locals, fetch }) => {
2024-04-09 00:10:23 -04:00
const getRecommendations = async (): Promise<(Song | Album | Artist | Playlist)[]> => {
const recommendationResponse = await fetch(`/api/users/${locals.user.id}/recommendations`, {
headers: { apikey: SECRET_INTERNAL_API_KEY },
}).then((response) => response.json())
return recommendationResponse.recommendations
}
2024-04-09 00:10:23 -04:00
return { recommendations: getRecommendations() }
2024-02-04 01:01:37 -05:00
}