feat: enhance admin and profile repositories with token handling; update dropdown initial values in various screens

This commit is contained in:
Nils-Johan Gynther
2026-04-23 21:34:08 +02:00
parent 111d196403
commit b589f7415d
15 changed files with 63 additions and 36 deletions
@@ -17,7 +17,7 @@ class RecipeRepository {
throw const ApiException(
type: ApiErrorType.unknown, message: 'Ogiltigt svar från servern.');
}
return (data as List)
return data
.map((e) => Recipe.fromJson(e as Map<String, dynamic>))
.toList();
} on ApiException {
@@ -399,7 +399,7 @@ class _RecipeEditScreenState extends ConsumerState<RecipeEditScreen> {
],
),
DropdownButtonFormField<int>(
value: ingredient.productId,
initialValue: ingredient.productId,
isExpanded: true,
decoration: const InputDecoration(
labelText: 'Produkt *',
@@ -461,7 +461,7 @@ class _RecipeEditScreenState extends ConsumerState<RecipeEditScreen> {
const SizedBox(width: 12),
Expanded(
child: DropdownButtonFormField<String>(
value: ingredient.unit.trim().isEmpty ? null : ingredient.unit,
initialValue: ingredient.unit.trim().isEmpty ? null : ingredient.unit,
isExpanded: true,
decoration: const InputDecoration(
labelText: 'Enhet *',