Notify user of action happening on button press

This commit is contained in:
2025-05-15 21:01:38 -07:00
parent 5c37017bd5
commit 05e14894ac
3 changed files with 11 additions and 9 deletions
@@ -34,7 +34,7 @@
}
public async Task TrySendCode() {
Result = "Waiting on response from server";
HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/sendresetpassword", new Account(){ Email = Email });
Result = await TestLogin.Content.ReadAsStringAsync();
@@ -4,6 +4,7 @@
<form class="center big-frame background-border">
<h3>Reset Password</h3>
<span>User: @UserName</span>
<div class="frame-item">
<input type="password" placeholder=" " @bind="NewPassword" @onkeyup="OnKeyDown" />
<label>New Password</label>
@@ -48,10 +49,17 @@
}
protected async Task TryChange() {
Result = "Waiting on response from server";
HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/resetpassword", new Account(){ UserName = UserName, PasswordHash = NewPassword, Error = ResetPwd });
string result = await TestLogin.Content.ReadAsStringAsync();
Result = result == "true" ? "Password changed successfully" : "Something is wrong";
bool success = result == "true" ? true : false;
if (success){
Result = "Password changed successfully";
await Task.Delay(2000);
Nav.NavigateTo("/", true);
}else{
Result = "Something is wrong";
}
}
}