This commit is contained in:
Frede Hundewadt 2022-11-28 15:45:11 +01:00
parent f4d96ec774
commit 117bb1a759
4 changed files with 17 additions and 11 deletions

View file

@ -82,8 +82,8 @@
</a> </a>
} }
} }
else
{
<LoaderThreeDots/>
}
</div> </div>
else
{
<LoaderThreeDots/>
}

View file

@ -66,6 +66,8 @@ namespace Wonky.Client.Services
IsSuccess = false, ErrorMessage = $"Kontroller indtastning" IsSuccess = false, ErrorMessage = $"Kontroller indtastning"
}; };
Console.WriteLine(resContent);
// process response content // process response content
var data = JsonSerializer.Deserialize<AuthResponseView>(resContent, _options); var data = JsonSerializer.Deserialize<AuthResponseView>(resContent, _options);
await _localStorage.SetItemAsync("_xa", data.AccessToken); await _localStorage.SetItemAsync("_xa", data.AccessToken);
@ -75,6 +77,7 @@ namespace Wonky.Client.Services
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", data.AccessToken); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", data.AccessToken);
var userInfo = await UserInfo(); var userInfo = await UserInfo();
await _localStorage.SetItemAsync("_xu", userInfo); await _localStorage.SetItemAsync("_xu", userInfo);
// notify system on state change // notify system on state change
@ -119,7 +122,9 @@ namespace Wonky.Client.Services
public async Task<UserInfoView> UserInfo(bool write = false) public async Task<UserInfoView> UserInfo(bool write = false)
{ {
var infoResponse = await _client.GetAsync(_apiConfig.Value.UserInfo); _logger.LogDebug("sending userinfo request");
var infoResponse = await _client.GetAsync(_apiConfig.Value.UserInfo).ConfigureAwait(true);
var infoContent = await infoResponse.Content.ReadAsStringAsync(); var infoContent = await infoResponse.Content.ReadAsStringAsync();
_logger.LogDebug("UserInfo <= {}", infoContent); _logger.LogDebug("UserInfo <= {}", infoContent);

View file

@ -1,13 +1,13 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.60.1", "version": "0.70.2",
"rc": true, "rc": true,
"sandBox": true, "sandBox": false,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },
"apiConfig": { "apiConfig": {
"baseUrl": "https://dev.innotec.dk", "baseUrl": "https://zeta.innotec.dk",
"catalog": "api/v2/catalog", "catalog": "api/v2/catalog",
"crmCustomers": "api/v2/crm/companies", "crmCustomers": "api/v2/crm/companies",
"crmInventoryExt": "history/inventory", "crmInventoryExt": "history/inventory",

View file

@ -19,14 +19,13 @@ namespace Wonky.Entity.Views;
public class UserInfoView public class UserInfoView
{ {
[JsonPropertyName("id")] public string Id { get; set; } = "";
[JsonPropertyName("advisor")] public string Advisor { get; set; } = ""; [JsonPropertyName("advisor")] public string Advisor { get; set; } = "";
[JsonPropertyName("companyId")] public string ReferenceId { get; set; } = ""; [JsonPropertyName("companyId")] public string ReferenceId { get; set; } = "";
[JsonPropertyName("countryCode")] public string CountryCode { get; set; } = ""; [JsonPropertyName("countryCode")] public string CountryCode { get; set; } = "";
[JsonPropertyName("countryName")] public string CountryName { get; set; } = ""; [JsonPropertyName("countryName")] public string CountryName { get; set; } = "";
[JsonPropertyName("email")] public string Email { get; set; } = ""; [JsonPropertyName("email")] public string Email { get; set; } = "";
[JsonPropertyName("fullName")] public string FullName { get; set; } = ""; [JsonPropertyName("fullName")] public string FullName { get; set; } = "";
[JsonPropertyName("phoneNumber")] public string PhoneNumber { get; set; } = ""; [JsonPropertyName("id")] public string Id { get; set; } = "";
[JsonPropertyName("isAdmin")] public bool IsAdmin { get; set; } [JsonPropertyName("isAdmin")] public bool IsAdmin { get; set; }
[JsonPropertyName("isAdvisor")] public bool IsAdvisor { get; set; } [JsonPropertyName("isAdvisor")] public bool IsAdvisor { get; set; }
[JsonPropertyName("isEDoc")] public bool IsEDoc { get; set; } [JsonPropertyName("isEDoc")] public bool IsEDoc { get; set; }
@ -34,4 +33,6 @@ public class UserInfoView
[JsonPropertyName("isOffice")] public bool IsOffice { get; set; } [JsonPropertyName("isOffice")] public bool IsOffice { get; set; }
[JsonPropertyName("isWarehouse")] public bool IsWareHouse { get; set; } [JsonPropertyName("isWarehouse")] public bool IsWareHouse { get; set; }
[JsonPropertyName("isSupervisor")] public bool IsSupervisor { get; set; } [JsonPropertyName("isSupervisor")] public bool IsSupervisor { get; set; }
[JsonPropertyName("phoneNumber")] public string PhoneNumber { get; set; } = "";
[JsonPropertyName("roles")] public string Roles { get; set; } = "";
} }