mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-08 00:17:29 +00:00
Compare commits
2 Commits
893a428bb9
...
f3052314f1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3052314f1 | ||
|
|
d9057dae57 |
@ -30,12 +30,31 @@ class FeaturedPlaylistsNotifier
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
fetch(int offset, int limit) async {
|
fetch(int offset, int limit) async {
|
||||||
final playlists = await spotify.playlists.featured.getPage(
|
try {
|
||||||
limit,
|
final playlists = await spotify.playlists.featured.getPage(
|
||||||
offset,
|
limit,
|
||||||
);
|
offset,
|
||||||
|
);
|
||||||
|
|
||||||
return playlists.items?.toList() ?? [];
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user