feat: add Flutter web frontend with authentication and recipe management features

This commit is contained in:
Nils-Johan Gynther
2026-04-21 21:29:47 +02:00
parent 2acf66e4c4
commit 3996456f6f
19 changed files with 460 additions and 0 deletions
@@ -0,0 +1,20 @@
import 'dart:convert';
import '../../../core/api/api_client.dart';
import '../domain/recipe.dart';
class RecipeRepository {
final ApiClient _api;
RecipeRepository(this._api);
Future<List<Recipe>> fetchRecipes({String? token}) async {
final response = await _api.get('/api/recipes', token: token);
if (response.statusCode != 200) {
throw Exception('Failed to load recipes: ${response.statusCode}');
}
final List<dynamic> data = jsonDecode(response.body) as List<dynamic>;
return data
.map((e) => Recipe.fromJson(e as Map<String, dynamic>))
.toList();
}
}