Started on media player
This commit is contained in:
@@ -2,11 +2,12 @@ import { SECRET_INTERNAL_API_KEY } from '$env/static/private'
|
||||
import type { PageServerLoad } from './$types'
|
||||
|
||||
export const load: PageServerLoad = async ({ locals, fetch }) => {
|
||||
const recommendationResponse = await fetch(`/api/users/${locals.user.id}/recommendations`, {
|
||||
headers: { apikey: SECRET_INTERNAL_API_KEY },
|
||||
}).then((response) => response.json())
|
||||
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
|
||||
}
|
||||
|
||||
const recommendations: (Song | Album | Artist | Playlist)[] = recommendationResponse.recommendations
|
||||
|
||||
return { recommendations }
|
||||
return { recommendations: getRecommendations() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user