chore: scrobbling
This commit is contained in:
parent
478d8a956a
commit
8e9357fca7
1 changed files with 5 additions and 3 deletions
|
@ -4,7 +4,7 @@ export default async (request) => {
|
||||||
const API_KEY_MUSIC = Netlify.env.get('API_KEY_MUSIC');
|
const API_KEY_MUSIC = Netlify.env.get('API_KEY_MUSIC');
|
||||||
const params = new URL(request['url']).searchParams
|
const params = new URL(request['url']).searchParams
|
||||||
const key = params.get('key')
|
const key = params.get('key')
|
||||||
const weeks = params.get('key').split(',')
|
const weeks = params.get('key')?.split(',')
|
||||||
|
|
||||||
if (!key) return new Response(JSON.stringify({
|
if (!key) return new Response(JSON.stringify({
|
||||||
status: 'Bad request',
|
status: 'Bad request',
|
||||||
|
@ -26,8 +26,10 @@ export default async (request) => {
|
||||||
scrobbleData.push(weekData['data'])
|
scrobbleData.push(weekData['data'])
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const weekData = await scrobbles.get('window', { type: 'json'})
|
const windowData = await scrobbles.get('window', { type: 'json'})
|
||||||
scrobbleData.push(weekData['data'])
|
console.log(windowData)
|
||||||
|
console.log(scrobbleData)
|
||||||
|
scrobbleData.push(windowData['data'])
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Response(JSON.stringify({ data: scrobbleData }),
|
return new Response(JSON.stringify({ data: scrobbleData }),
|
||||||
|
|
Reference in a new issue