changePassword method

Future<void> changePassword({
  1. required String currentPassword,
  2. required String newPassword,
})

Changes the user password given currentPassword and newPassword.

Implementation

Future<void> changePassword({
  required String currentPassword,
  required String newPassword,
}) async {
  final hdrs = await auth.headers();
  final uri = auth.baseUrl.resolve('/auth/account/change-password');
  await auth.dio.post<dynamic>(
    uri.toString(),
    data: {'current_password': currentPassword, 'new_password': newPassword},
    options: Options(headers: {'Accept': 'application/json', ...hdrs}),
  );
}