This commit is contained in:
mmrbnjd
2024-04-19 03:23:30 +03:30
parent 77e004d090
commit f4668f8f4d
7 changed files with 158 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
@page "/Sign-in"
@page "/Sign-in/{from}"
@using Front.Services
@using Shared.DTOs
@inject ILocalStorageService Storage;
@@ -116,7 +117,11 @@
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
<Icon Name="@alertIconName" class="me-2"></Icon>
@alertMessage
<Button Color="ButtonColor.Primary" @onclick="EndForm">اتمام عملیات</Button>
@if (showbtn)
{
<Button Color="ButtonColor.Primary" @onclick="EndForm">اتمام عملیات</Button>
}
</Alert>
@@ -133,6 +138,9 @@
</main>
@code {
[Parameter]
public string from { get; set; } = "";
bool showbtn = false;
[SupplyParameterFromForm]
public Authentication? Model { get; set; }
// alert
@@ -140,11 +148,19 @@
IconName alertIconName = IconName.CheckCircleFill;
bool Hidealert = true;
string alertMessage = "";
protected override async Task OnParametersSetAsync()
{
if (from == "Verification")
{
ShowSuccessAlert("ثبت نام شما با موفقیت انجام شد");
}
await base.OnParametersSetAsync();
}
protected override async Task OnInitializedAsync()
{
if (await localserv.OnlineUser())
nav.NavigateTo("/");
nav.NavigateTo("/Panel");
Model ??= new();
await base.OnInitializedAsync();
@@ -153,11 +169,20 @@
@functions {
private void ShowDangerAlert(string msg)
{
showbtn = true;
Hidealert = false;
alertColor = AlertColor.Danger;
alertIconName = IconName.ExclamationTriangleFill;
alertMessage = msg;
}
private void ShowSuccessAlert(string msg)
{
showbtn = false;
Hidealert = false;
alertColor = AlertColor.Success;
alertIconName = IconName.CheckCircleFill;
alertMessage = msg;
}
private async Task EndForm() => nav.NavigateTo("/");
@@ -184,7 +209,7 @@
userinfo.enterDate = userinfomodel.enterDate;
nav.NavigateTo("/");
nav.NavigateTo("/Panel");
}
else if (request.StatusCode == System.Net.HttpStatusCode.NotFound)
ShowDangerAlert("کاربری با این مشخصات یافت نشد");