fix: correct property names and Series.maybeMap usage

Fix compilation errors in library browser views:
- Use serverUrl instead of url on AudiobookShelfServer model
- Use authToken instead of token on AuthenticatedUser model
- Add all required variant handlers to Series.maybeMap call

These changes align with the actual model definitions in the codebase.
This commit is contained in:
Claude 2025-11-20 12:45:29 +00:00
parent fafd4c5315
commit 3da7b60ded
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View file

@ -87,7 +87,7 @@ class AuthorCard extends HookConsumerWidget {
// Build the image URL if imagePath is available
String? imageUrl;
if (imagePath != null && apiSettings.activeServer != null) {
imageUrl = '${apiSettings.activeServer!.url}/api/authors/${author.id}/image';
imageUrl = '${apiSettings.activeServer!.serverUrl}/api/authors/${author.id}/image';
}
return Card(
@ -111,7 +111,7 @@ class AuthorCard extends HookConsumerWidget {
? CachedNetworkImage(
imageUrl: imageUrl,
httpHeaders: {
'Authorization': 'Bearer ${apiSettings.activeUser?.token}',
'Authorization': 'Bearer ${apiSettings.activeUser?.authToken}',
},
fit: BoxFit.cover,
placeholder: (context, url) => Container(

View file

@ -62,8 +62,12 @@ class SeriesListTile extends StatelessWidget {
// Extract series data based on variant
final String seriesName = series.name;
final int? numBooks = series.maybeMap(
(s) => null, // base variant
numBooks: (s) => s.numBooks,
books: (s) => s.books.length,
sequence: (s) => null,
shelf: (s) => s.books.length,
author: (s) => s.items?.length,
orElse: () => null,
);