5613fec5ef
The server has always returned an enveloped response from GET
/api/playlists; the existing client decoded it as a flat List which
fails at runtime against the actual Map shape. Existing playlists
list screen would have been broken on any production instance.
list() now returns PlaylistsList { owned, public }. The existing
list screen consumes lists.all (owned + public flattened) — same
visible output as the previous flat-list assumption.
This unblocks the home parity slice which needs the same endpoint
for the new Playlists row.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
20 lines
679 B
Dart
20 lines
679 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../api/endpoints/playlists.dart';
|
|
import '../library/library_providers.dart' show dioProvider;
|
|
import '../models/playlist.dart';
|
|
|
|
final playlistsApiProvider = FutureProvider<PlaylistsApi>((ref) async {
|
|
return PlaylistsApi(await ref.watch(dioProvider.future));
|
|
});
|
|
|
|
final playlistsListProvider =
|
|
FutureProvider.family<PlaylistsList, String>((ref, kind) async {
|
|
return (await ref.watch(playlistsApiProvider.future)).list(kind: kind);
|
|
});
|
|
|
|
final playlistDetailProvider =
|
|
FutureProvider.family<PlaylistDetail, String>((ref, id) async {
|
|
return (await ref.watch(playlistsApiProvider.future)).get(id);
|
|
});
|