feat(inventory): add inventory preview functionality and related models
This commit is contained in:
@@ -4,6 +4,7 @@ import '../../../core/api/api_providers.dart';
|
||||
import '../../../core/api/guarded_api_call.dart';
|
||||
import '../../../features/auth/data/auth_providers.dart';
|
||||
import '../domain/recipe.dart';
|
||||
import '../domain/inventory_preview.dart';
|
||||
import 'recipe_repository.dart';
|
||||
|
||||
final recipeRepositoryProvider = Provider<RecipeRepository>((ref) {
|
||||
@@ -26,3 +27,14 @@ final recipeDetailProvider =
|
||||
() => ref.read(recipeRepositoryProvider).fetchRecipeDetail(id, token: token),
|
||||
);
|
||||
});
|
||||
|
||||
final inventoryPreviewProvider =
|
||||
FutureProvider.family<InventoryPreview, int>((ref, id) async {
|
||||
final token = await ref.watch(authStateProvider.future);
|
||||
return guardedApiCall(
|
||||
ref,
|
||||
() => ref
|
||||
.read(recipeRepositoryProvider)
|
||||
.fetchInventoryPreview(id, token: token),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user