changePassword method

Future<Response> changePassword({
  1. required String oldPassword,
  2. required String newPassword,
  3. required String confirmPassword,
})

To change user password in whitelabel app user needs to use below API

Implementation

Future<http.Response> changePassword({
  required String oldPassword,
  required String newPassword,
  required String confirmPassword,
}) async {
  Uri url = Uri.parse("$_baseUrl/user/change-password");

  final body = jsonEncode({
    "old_password": oldPassword,
    "new_password": newPassword,
    "confirm_password": confirmPassword,
  });

  http.Response response = await http.Client()
      .put(url, body: body, headers: kAuthenticatedPostRequestHeader);

  if (response.statusCode == 200) {
    printMessage("CHANGE PASSWORD RESPONSE = ${response.body}");
    return response;
  } else {
    printMessage("CHANGE PASSWORD RESPONSE = ${response.statusCode}");
    printMessage("CHANGE PASSWORD RESPONSE = ${response.body}");
    return response;
  }
}