Files
recipe-app/flutter/lib/features/profile/data/profile_repository.dart
T
Nils-Johan Gynther a5c13a4b3c Remove outdated Flutter migration documents and add new technical descriptions and profile repository implementation
- Deleted `next_steps_flutter.md` and `teknisk_beskrivning_flutter.md` files as they were outdated.
- Added new `next_steps_flutter.md` and `teknisk_beskrivning_flutter.md` files with updated migration plans and technical descriptions for the Flutter frontend.
- Implemented `profile_repository.dart` to handle profile data retrieval and updates using the API.

Co-authored-by: Copilot <copilot@github.com>
2026-04-23 16:40:02 +02:00

27 lines
812 B
Dart

import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../core/api/api_client.dart';
import '../../../core/api/guarded_api_call.dart';
import '../../../core/api/api_exception.dart';
final profileRepositoryProvider = Provider<ProfileRepository>((ref) {
final apiClient = ref.read(apiClientProvider);
return ProfileRepository(apiClient);
});
class ProfileRepository {
final ApiClient _apiClient;
ProfileRepository(this._apiClient);
Future<Map<String, dynamic>> getProfile() async {
return guardedApiCall(
() => _apiClient.getJson('/api/profile'),
);
}
Future<Map<String, dynamic>> updateProfile(Map<String, dynamic> profileData) async {
return guardedApiCall(
() => _apiClient.patchJson('/api/profile', profileData),
);
}
}