updateUserPasswordState method
Future<PasswordStateResponse>
updateUserPasswordState(
- String userId,
- PasswordStateRequest passwordStateRequest
Implementation
Future<PasswordStateResponse> updateUserPasswordState(String userId, PasswordStateRequest passwordStateRequest) async {
final url = Uri.parse('${_wepinBaseUrl}user/$userId/password-state');
final jsonRequestBody = jsonEncode(passwordStateRequest.toJson());
final response = await http.patch(
url,
headers: headers,
body: jsonRequestBody,
);
if (response.statusCode >= 200 && response.statusCode < 300) {
final responseBody = jsonDecode(response.body);
return PasswordStateResponse.fromJson(responseBody);
} else {
throw WepinError(WepinErrorCode.failedPasswordStateSetting, 'code: ${response.statusCode} , body: ${response.body}');
}
}