diff --git a/Client/Pages/Auth/Login.razor b/Client/Pages/Auth/Login.razor
index 0a7aa13..b456c32 100644
--- a/Client/Pages/Auth/Login.razor
+++ b/Client/Pages/Auth/Login.razor
@@ -87,21 +87,19 @@
usernameInput(args.Value.ToString()))" @onkeydown="@Enter" />
- @if (showUsernameError)
- {
-
Enter valid Uaername
- }
-
+ @if (!validStatus)
+ {
+ @errormeaasge("invalid")
+ }
diff --git a/Client/Pages/Auth/Login.razor.cs b/Client/Pages/Auth/Login.razor.cs
index 2c512f9..2736d42 100644
--- a/Client/Pages/Auth/Login.razor.cs
+++ b/Client/Pages/Auth/Login.razor.cs
@@ -13,6 +13,7 @@ namespace Biskilog_Accounting.Client.Pages.Auth
private bool showUsernameError, showPasswordError;
private bool m_remember { get; set; }
protected bool IsVisible { get; set; }
+ public bool validStatus = false;
//NotificationMessage notificationMessage = new NotificationMessage();
private Userauth authenticatedUser;
@@ -47,28 +48,26 @@ namespace Biskilog_Accounting.Client.Pages.Auth
var responseMain = await m_http.PostAsJsonAsync("api/authentication/type-a", authenticatedUser);
if (responseMain.IsSuccessStatusCode)
{
- showUsernameError = string.IsNullOrEmpty(m_email);
- showPasswordError = string.IsNullOrEmpty(m_password);
- if(!showUsernameError && !showPasswordError)
- {
- string token = await responseMain.Content.ReadAsStringAsync();
- await m_tokenService.SetToken(token, m_remember);
+ validStatus = true;
- var authHeader = new AuthenticationHeaderValue("Bearer", token);
- m_http.DefaultRequestHeaders.Authorization = authHeader;
+ string token = await responseMain.Content.ReadAsStringAsync();
+ await m_tokenService.SetToken(token, m_remember);
+
+ var authHeader = new AuthenticationHeaderValue("Bearer", token);
+ m_http.DefaultRequestHeaders.Authorization = authHeader;
+
+ m_navigationManager.NavigateTo("/");
- m_navigationManager.NavigateTo("/");
- }
}
-
+
else if (responseMain.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
}
}
- catch (Exception ex)
+ catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
@@ -120,6 +119,17 @@ namespace Biskilog_Accounting.Client.Pages.Auth
StateHasChanged();
}
-
+ public string errormeaasge(string message)
+ {
+ showPasswordError = string.IsNullOrEmpty(m_email);
+ showUsernameError = string.IsNullOrEmpty(m_password);
+
+ if (showUsernameError && showPasswordError)
+ {
+ message = "";
+ }
+ return message;
+
+ }
}
}
\ No newline at end of file