1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 06:01:17 -04:00

add getStaticProps types

This commit is contained in:
2022-06-30 20:56:34 -04:00
parent 5f22b7989d
commit 887c24d317
17 changed files with 67 additions and 50 deletions

View File

@@ -54,7 +54,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
await logServerError(error);
// 500 Internal Server Error
return res.status(500).json({ success: false, message });
return res.status(500).json({ message });
}
};
@@ -75,7 +75,7 @@ const getAccessToken = async () => {
const { access_token: token } = await response.json();
return token as string;
return token;
};
const getNowPlaying = async (token: string): Promise<Track | false> => {
@@ -120,7 +120,7 @@ const getTopTracks = async (token: string): Promise<Track[]> => {
const { items } = (await response.json()) as { items: SpotifyTrackSchema[] };
const tracks: Track[] = items.map((track: SpotifyTrackSchema) => ({
const tracks = items.map<Track>((track) => ({
artist: track.artists.map((artist) => artist.name).join(", "),
title: track.name,
album: track.album.name,