chore: fix typescript with optional return from api call

This commit is contained in:
Lei Nelissen
2024-07-21 22:30:06 +02:00
parent 68c8808188
commit e0177fb89b
5 changed files with 13 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ export async function retrieveAllPlaylists() {
const playlistParams = new URLSearchParams(playlistOptions).toString();
return fetchApi<{ Items: Playlist[] }>(({ user_id }) => `/Users/${user_id}/Items?${playlistParams}`)
.then((d) => d.Items);
.then((d) => d!.Items);
}
/**
@@ -34,5 +34,5 @@ export async function retrievePlaylistTracks(ItemId: string) {
const singlePlaylistParams = new URLSearchParams(singlePlaylistOptions).toString();
return fetchApi<{ Items: AlbumTrack[] }>(`/Playlists/${ItemId}/Items?${singlePlaylistParams}`)
.then((d) => d.Items);
.then((d) => d!.Items);
}