a5c13a4b3c
- 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>
27 lines
812 B
Dart
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),
|
|
);
|
|
}
|
|
} |