mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
remove some unnecessary stuff
Signed-off-by: annon <annon@annon.me>
This commit is contained in:
parent
61f33eeeb8
commit
a297b973e6
1 changed files with 0 additions and 25 deletions
|
@ -1,26 +1 @@
|
||||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
||||||
import { SpotifyService } from '@/service/spotify';
|
|
||||||
|
|
||||||
const { CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN } = process.env;
|
|
||||||
const spotify = new SpotifyService(CLIENT_ID!, CLIENT_SECRET!, REFRESH_TOKEN!);
|
|
||||||
|
|
||||||
export default async function handler(
|
|
||||||
req: NextApiRequest,
|
|
||||||
res: NextApiResponse
|
|
||||||
) {
|
|
||||||
const song = await spotify.getCurrentSong();
|
|
||||||
if (!song || !song.isPlaying) {
|
|
||||||
return res.status(200).json({
|
|
||||||
nowplaying: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
res.status(200).json({
|
|
||||||
nowplaying: true,
|
|
||||||
song: {
|
|
||||||
artist: song.artists.name,
|
|
||||||
title: song.title,
|
|
||||||
url: song.url,
|
|
||||||
image: song.album.image,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue