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-05 02:00:17 -04:00
|
|
|
const recommendationResponse = await fetch(`/api/users/${locals.user.id}/recommendations`, {
|
|
|
|
|
headers: { apikey: SECRET_INTERNAL_API_KEY },
|
|
|
|
|
}).then((response) => response.json())
|
|
|
|
|
|
|
|
|
|
const recommendations: (Song | Album | Artist | Playlist)[] = recommendationResponse.recommendations
|
2024-02-04 01:01:37 -05:00
|
|
|
|
|
|
|
|
return { recommendations }
|
|
|
|
|
}
|