From a297b973e63fe18229f6e902d76d9c3017c17596 Mon Sep 17 00:00:00 2001 From: annon Date: Thu, 11 May 2023 22:43:13 +0200 Subject: [PATCH] remove some unnecessary stuff Signed-off-by: annon --- src/pages/api/spotify.ts | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/pages/api/spotify.ts b/src/pages/api/spotify.ts index 60450fb..8b13789 100644 --- a/src/pages/api/spotify.ts +++ b/src/pages/api/spotify.ts @@ -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, - }, - }); -}