setRole method
Set the role of a user
userId The ID of the user to set the role for
role The role to set for the user
Implementation
Future<SetRoleResponse<T>> setRole({
required String userId,
required String role,
}) async {
try {
final response = await super.dio.post(
"/admin/set-role",
data: {
"userId": userId,
"role": role,
},
options: await super.getOptions(isTokenRequired: true),
);
return SetRoleResponse<T>.fromJson(response.data, super.fromJsonUser);
} catch (e) {
final message = getErrorMessage(e);
if (message == null) rethrow;
throw message;
}
}