public async Task UpdatePassword() { PasswordForm.Submit(); StateHasChanged(); FormResponse Response = await JSRuntime.InvokeAsync <FormResponse>("UpdatePassword", PasswordForm.OldPassword, PasswordForm.NewPassword); if (Response.Success) { PasswordForm.Succeed(); await JSRuntime.InvokeVoidAsync("Alert", "success", "Password Changed", "Your password has been updated successfully."); PasswordForm.OldPassword = null; PasswordForm.NewPassword = null; ChangingPassword = false; } else { if (Response.FieldErrors != null) { PasswordForm.Fail(Response.FieldErrors[0]); } else { PasswordForm.Fail(Response.Error); } await JSRuntime.InvokeVoidAsync("Alert", "error", "Error", Response.Error); } StateHasChanged(); }