wpResetPassword method
Reset a user password using the userToken
and new password
created.
Returns a WCCustomerInfoResponse future. Throws an Exception if fails.
Implementation
Future<WPUserResetPasswordResponse> wpResetPassword({
required String password,
String? userToken,
}) async {
Map<String, dynamic> payload = {"password": password};
// send http request
final json = await _http(
method: "POST",
url: _urlForRouteType(WPRouteType.UserUpdatePassword),
body: payload,
userToken: userToken,
shouldAuthRequest: true);
// return response
return _jsonHasBadStatus(json)
? this._throwExceptionForStatusCode(json)
: WPUserResetPasswordResponse.fromJson(json);
}