diff --git a/Wonky.Client/Components/AdvisorCustomerListComponent.razor b/Wonky.Client/Components/AdvisorCustomerListComponent.razor index 734b3eff..74c64e81 100644 --- a/Wonky.Client/Components/AdvisorCustomerListComponent.razor +++ b/Wonky.Client/Components/AdvisorCustomerListComponent.razor @@ -33,7 +33,7 @@ @foreach (var company in CompanyList) { - + diff --git a/Wonky.Client/Components/CustomerActivityListComponent.razor b/Wonky.Client/Components/CustomerActivityListComponent.razor index 15fd42ae..d4286ca7 100644 --- a/Wonky.Client/Components/CustomerActivityListComponent.razor +++ b/Wonky.Client/Components/CustomerActivityListComponent.razor @@ -37,7 +37,7 @@ { @foreach (var activity in Activities) { -
+
@activity.OrderDate diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor b/Wonky.Client/Components/CustomerInventoryListComponent.razor index 142eff7d..45f740ba 100644 --- a/Wonky.Client/Components/CustomerInventoryListComponent.razor +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor @@ -23,9 +23,9 @@
-
Navn
-
Varenr
-
Antal
+
Navn
+
Varenr
+
Antal
@@ -51,9 +51,9 @@ @product.Quantity
- Genbestil +
-
+
@if (product.Check) { diff --git a/Wonky.Client/Components/CustomerInvoiceListComponent.razor b/Wonky.Client/Components/CustomerInvoiceListComponent.razor index 3352e137..6f49eeb3 100644 --- a/Wonky.Client/Components/CustomerInvoiceListComponent.razor +++ b/Wonky.Client/Components/CustomerInvoiceListComponent.razor @@ -39,7 +39,7 @@
@foreach (var invoice in InvoiceList) { -
+
@invoice.DocumentDate
@invoice.DocumentNumber
diff --git a/Wonky.Client/Components/CustomerProductCheckListComponent.razor b/Wonky.Client/Components/CustomerProductCheckListComponent.razor index c811e6ae..40c7ba08 100644 --- a/Wonky.Client/Components/CustomerProductCheckListComponent.razor +++ b/Wonky.Client/Components/CustomerProductCheckListComponent.razor @@ -22,9 +22,9 @@
-
Navn
-
Varenr
-
Antal
+
Navn
+
Varenr
+
Antal
@@ -44,7 +44,7 @@
-
+
@if (product.Check) { diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor index 459bbdaf..591d301c 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor @@ -51,13 +51,13 @@ \ No newline at end of file diff --git a/Wonky.Client/Components/WarehouseListComponent.razor b/Wonky.Client/Components/WarehouseListComponent.razor index 594043dc..1bbce393 100644 --- a/Wonky.Client/Components/WarehouseListComponent.razor +++ b/Wonky.Client/Components/WarehouseListComponent.razor @@ -42,7 +42,7 @@
@if (ReadyToShip && Orders.Any()) { - + }
@@ -84,7 +84,7 @@ @switch (order.ProcessStatusEnum.ToLower()) { case "none": - + Pluk varer break; case "picked": diff --git a/Wonky.Client/Local.Services/AuthenticationService.cs b/Wonky.Client/Local.Services/AuthenticationService.cs index 5786472c..6ae84127 100644 --- a/Wonky.Client/Local.Services/AuthenticationService.cs +++ b/Wonky.Client/Local.Services/AuthenticationService.cs @@ -72,7 +72,7 @@ public class AuthenticationService : IAuthenticationService if (!response.IsSuccessStatusCode) return new AuthResponseView { - IsSuccess = false, ErrorMessage = $"Kontroller indtastning" + IsSuccess = false, ErrorMessage = "Kontroller indtastning" }; // process response content @@ -99,20 +99,31 @@ public class AuthenticationService : IAuthenticationService public async Task RefreshToken() { var refreshToken = await _infoService.GetRefreshToken(); + await Task.Delay(250); + if (string.IsNullOrWhiteSpace(refreshToken)) + { + return string.Empty; + } + var credentials = new Dictionary { ["grant_type"] = "refresh_token", ["refresh_token"] = refreshToken }; + var response = await _client.PostAsync(_apiConfig.Value.ServicesAuth, new FormUrlEncodedContent(credentials)); - if (!response.IsSuccessStatusCode) + var content = await response.Content.ReadAsStringAsync(); + if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) + { return string.Empty; - - var resContent = await response.Content.ReadAsStringAsync(); - var data = JsonSerializer.Deserialize(resContent, _options); - + } + + var data = JsonSerializer.Deserialize(content, _options); + if (string.IsNullOrWhiteSpace(data.AccessToken)) + { return string.Empty; + } // set default request headers using access_token _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", data.AccessToken); @@ -124,12 +135,12 @@ public class AuthenticationService : IAuthenticationService public async Task Logout() { - var profileBackup = await _preference.GetProfile(); - Task.Delay(150); - await _localStorage.ClearAsync(); - Task.Delay(150); - await _preference.SetProfile(profileBackup); _client.DefaultRequestHeaders.Authorization = null; + var profileBackup = await _preference.GetProfile(); + await Task.Delay(150); + await _localStorage.ClearAsync(); + await Task.Delay(150); + await _preference.SetProfile(profileBackup); ((AuthStateProvider)_authStateProvider).NotifyUserLogout(); } diff --git a/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor b/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor index b09c8653..ad144b06 100644 --- a/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor +++ b/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor @@ -18,7 +18,7 @@