spotube/lib/provider/spotify/views/home.dart
2024-06-14 00:29:09 +06:00

23 lines
703 B
Dart

import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/provider/authentication_provider.dart';
import 'package:spotube/provider/custom_spotify_endpoint_provider.dart';
import 'package:spotube/provider/user_preferences/user_preferences_provider.dart';
final homeViewProvider = FutureProvider((ref) async {
final country = ref.watch(
userPreferencesProvider.select((s) => s.market),
);
final spTCookie = ref.watch(
authenticationProvider.select((s) => s?.getCookie("sp_t")),
);
if (spTCookie == null) return null;
final spotify = ref.watch(customSpotifyEndpointProvider);
return spotify.getHomeFeed(
country: country,
spTCookie: spTCookie,
);
});