end verification
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
|
||||
<div class="signin-banner-from-box">
|
||||
|
||||
@* <EditForm EditContext="editContext" OnValidSubmit="SubmitVerificationCode"> *@
|
||||
|
||||
<EditForm Model="VerificationCodeModel" OnSubmit="SubmitVerificationCode" FormName="VerificationCodeDto">
|
||||
|
||||
@@ -70,7 +69,8 @@
|
||||
|
||||
</div>
|
||||
<div class="signin-banner-from-register">
|
||||
<NavLink href="Register">کد ارسال نشد؟ <span>ارسال مجدد</span></NavLink>
|
||||
<NavLink style="cursor:pointer" @onclick="ReSend">کد ارسال نشد؟ <span>ارسال مجدد</span></NavLink>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,7 +81,7 @@
|
||||
</main>
|
||||
|
||||
@code {
|
||||
|
||||
bool successfull = false;
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
@@ -95,7 +95,6 @@
|
||||
[SupplyParameterFromForm]
|
||||
public VerificationCodeDto? VerificationCodeModel { get; set; } = new VerificationCodeDto();
|
||||
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
var request = await _hc.GetAsync($"Verification/GetVerification/{ID}");
|
||||
@@ -114,6 +113,21 @@
|
||||
}
|
||||
@functions {
|
||||
|
||||
private async Task ReSend()
|
||||
{
|
||||
|
||||
var request = await _hc.GetAsync($"Verification/ReSend/{VerificationCodeModel?.ID}");
|
||||
if (request.IsSuccessStatusCode)
|
||||
{
|
||||
ShowSuccessAlert("کد مجدد ارسال شد");
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDangerAlert(await request.Content.ReadFromJsonAsync<string>());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private async Task SubmitVerificationCode()
|
||||
{
|
||||
if (VerificationCodeModel.Code < 1000 || VerificationCodeModel.Code > 9000)
|
||||
@@ -129,6 +143,7 @@
|
||||
if (status)
|
||||
{
|
||||
ShowSuccessAlert("عملیات با موفقیت انجام شد");
|
||||
successfull = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -157,5 +172,11 @@
|
||||
alertIconName = IconName.ExclamationTriangleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private async Task EndForm() => nav.NavigateTo("/");
|
||||
private async Task EndForm()
|
||||
{
|
||||
if (!successfull)
|
||||
await _hc.DeleteAsync($"Verification/Remove/{VerificationCodeModel?.ID}");
|
||||
|
||||
nav.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user