updatePassword static method
update current user's password.
Implementation
static Future<AuthResult> updatePassword(String newPassword,
[String? oldPassword]) async {
Map map = {};
map.putIfAbsent('newPassword', () => Util.encrypt(newPassword));
if (oldPassword != null) {
map.putIfAbsent('oldPassword', () => Util.encrypt(oldPassword));
}
final Result result =
await post('/api/v2/password/update', jsonEncode(map));
AuthResult authResult = AuthResult(result);
if (result.code == 200) {
authResult.user = await createUser(result);
}
return authResult;
}