updateUser method
Updates the user with the given userID
using the provided userData
.
Returns the updated user object if the API call is successful.
Implementation
Future<User> updateUser(User userData, int userID) async {
final response = await callApi(
endpoint: 'users/$userID', method: 'put', body: userData.toJson());
if (response.statusCode == 200) {
final responseData = json.decode(response.body);
final updatedUser = User.fromJson(responseData);
return updatedUser;
} else {
throw Exception(response);
}
}