mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-07 15:59:42 +00:00
Compare commits
1 Commits
903b6a2fba
...
08d41e3b66
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08d41e3b66 |
@ -30,31 +30,12 @@ class FeaturedPlaylistsNotifier
|
||||
|
||||
@override
|
||||
fetch(int offset, int limit) async {
|
||||
try {
|
||||
final playlists = await spotify.playlists.featured.getPage(
|
||||
limit,
|
||||
offset,
|
||||
);
|
||||
final playlists = await spotify.playlists.featured.getPage(
|
||||
limit,
|
||||
offset,
|
||||
);
|
||||
|
||||
return playlists.items?.toList() ?? [];
|
||||
} catch (e) {
|
||||
/// This check only needs to be done once. Since this is one of the very first
|
||||
/// request
|
||||
///
|
||||
/// If the token is invalid, we refresh it and retry the request.
|
||||
/// Same goes for expired tokens
|
||||
if ((e is AuthorizationException && e.error == 'invalid_token') ||
|
||||
e is ExpirationException) {
|
||||
await ref.read(authenticationProvider.notifier).refreshCredentials();
|
||||
|
||||
final playlists = await spotify.playlists.featured.getPage(
|
||||
limit,
|
||||
offset,
|
||||
);
|
||||
return playlists.items?.toList() ?? [];
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
return playlists.items?.toList() ?? [];
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user