feat: enhance admin and profile repositories with token handling; update dropdown initial values in various screens
This commit is contained in:
@@ -16,9 +16,10 @@ class ProfileRepository {
|
||||
ProfileRepository(this._apiClient, this._ref);
|
||||
|
||||
Future<UserProfile> getMe() async {
|
||||
final token = await _ref.read(authStateProvider.future);
|
||||
final data = await guardedApiCall(
|
||||
_ref,
|
||||
() => _apiClient.getJson(UserApiPaths.me),
|
||||
() => _apiClient.getJson(UserApiPaths.me, token: token),
|
||||
);
|
||||
return UserProfile.fromJson(data);
|
||||
}
|
||||
@@ -28,6 +29,7 @@ class ProfileRepository {
|
||||
String? firstName,
|
||||
String? lastName,
|
||||
}) async {
|
||||
final token = await _ref.read(authStateProvider.future);
|
||||
final body = <String, dynamic>{
|
||||
if (email != null) 'email': email,
|
||||
if (firstName != null) 'firstName': firstName,
|
||||
@@ -35,7 +37,7 @@ class ProfileRepository {
|
||||
};
|
||||
final data = await guardedApiCall(
|
||||
_ref,
|
||||
() => _apiClient.patchJson(UserApiPaths.me, body: body),
|
||||
() => _apiClient.patchJson(UserApiPaths.me, body: body, token: token),
|
||||
);
|
||||
return UserProfile.fromJson(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user