updatePassword method

Future<Account> updatePassword({
  1. required String password,
  2. String? oldPassword,
})

Update Password

Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.

Implementation

Future<models.Account> updatePassword(
    {required String password, String? oldPassword}) async {
  const String path = '/account/password';

  final Map<String, dynamic> params = {
    'password': password,
    'oldPassword': oldPassword,
  };

  final Map<String, String> headers = {
    'content-type': 'application/json',
  };

  final res = await client.call(HttpMethod.patch,
      path: path, params: params, headers: headers);

  return models.Account.fromMap(res.data);
}