Personal Site

Create getTrack function

vielle.dev a6b0a787 cc43861c

verified
+20
+20
src/components/playing/spotify.ts
··· 174 174 175 175 return trackID; 176 176 } 177 + 178 + export async function getTrack(id: string) { 179 + const res = await getSpotifyApi("/tracks/" + id); 180 + if (res instanceof Error) return res; 181 + return res as { 182 + external_urls: { 183 + spotify: string; 184 + }; 185 + images: { 186 + url: string; 187 + width: string; 188 + height: string; 189 + }[]; 190 + name: string; 191 + artists: { 192 + id: string; 193 + name: string; 194 + }[]; 195 + }; 196 + }