fix
This commit is contained in:
parent
c5031477e0
commit
98927033b2
@ -9,7 +9,7 @@ namespace ShipyardShopApp
|
||||
private static readonly HttpClient _client = new();
|
||||
|
||||
public static string Password { get; private set; } = string.Empty;
|
||||
public static bool Access { get; set; } = false;
|
||||
public static bool Access { get; private set; } = false;
|
||||
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
@ -18,6 +18,11 @@ namespace ShipyardShopApp
|
||||
_client.DefaultRequestHeaders.Accept.Clear();
|
||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
public static bool CheckPassword(string password)
|
||||
{
|
||||
APIClient.Access = password == Password;
|
||||
return APIClient.Access;
|
||||
}
|
||||
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
|
@ -28,8 +28,7 @@ namespace ShipyardShopApp.Controllers
|
||||
{
|
||||
throw new Exception("password");
|
||||
}
|
||||
APIClient.Access = password.Equals(APIClient.Password);
|
||||
if (APIClient.Access == false)
|
||||
if (APIClient.CheckPassword(password))
|
||||
{
|
||||
throw new Exception("Не верный пароль");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user