Avoid panic on spotify if not authed
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 3m35s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 3m35s
This commit is contained in:
@@ -53,10 +53,16 @@ func (store *Store) ListeningTo(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
func (store *Store) RecentlyPlayed(ctx *gin.Context) {
|
||||
if store.SpotifyClient == nil {
|
||||
ctx.JSON(500, gin.H{"error": "Spotify not authenticated"})
|
||||
return
|
||||
}
|
||||
|
||||
opts := spotify.RecentlyPlayedOptions{Limit: 3}
|
||||
|
||||
if store.RecentSongsFresh() {
|
||||
ctx.JSON(200, *store.RecentSongs)
|
||||
return
|
||||
}
|
||||
|
||||
played, err := store.SpotifyClient.PlayerRecentlyPlayedOpt(ctx, &opts)
|
||||
|
||||
Reference in New Issue
Block a user