fix - periodic bug where a workplace id mistakenly had quotation added in URL

This commit is contained in:
Frede Hundewadt 2023-08-31 14:43:28 +02:00
parent 773a502c57
commit b2989b60c6
3 changed files with 16 additions and 9 deletions

View file

@ -14,6 +14,7 @@
// //
using System.Text.Json;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository; using Wonky.Client.HttpRepository;
@ -31,6 +32,7 @@ public partial class AdvisorCustomerWorkplaceListPage : IDisposable
[Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; } [Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<AdvisorCustomerWorkplaceListPage> Logger { get; set; }
// ############################################################### // ###############################################################
@ -46,15 +48,16 @@ public partial class AdvisorCustomerWorkplaceListPage : IDisposable
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
await Task.Delay(1);
Company = await CustomerRepo.GetCompanyById(CompanyId); Company = await CustomerRepo.GetCompanyById(CompanyId);
await Task.Delay(1);
await Task.Delay(150);
Workplaces = await WorkplaceRepo.GetWorkplaces(CompanyId); Workplaces = await WorkplaceRepo.GetWorkplaces(CompanyId);
await Task.Delay(1);
Logger.LogDebug("workplaces <= {}", JsonSerializer.Serialize(Workplaces));
if (Workplaces.Count == 1) if (Workplaces.Count == 1)
{ {
Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces/{Workplaces[0].WorkplaceId}"); var workplaceId = Workplaces[0].WorkplaceId;
Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces/{workplaceId}");
} }
Working = false; Working = false;

View file

@ -15,6 +15,8 @@
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using Blazored.Toast;
using Blazored.Toast.Configuration;
using Blazored.Toast.Services; using Blazored.Toast.Services;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Forms;
@ -137,11 +139,13 @@ public partial class AdvisorCustomerWorkplaceRevisionPage : IDisposable
ProductVariants = Utils.GenerateVariantListDto(CurrentItems) ProductVariants = Utils.GenerateVariantListDto(CurrentItems)
}; };
Logger.LogDebug("submitRevision {}", JsonSerializer.Serialize(x)); Logger.LogDebug("submitRevision {}", JsonSerializer.Serialize(x));
Toaster.ShowWarning("Venter på backend ....", settings => settings.Timeout = 1000);
var delay = x.ProductVariants.Count * 500;
await Task.Delay(delay);
var result = await WorkplaceRepo.PostWorkplaceDocuments(CompanyId, WorkplaceId, x); var result = await WorkplaceRepo.PostWorkplaceDocuments(CompanyId, WorkplaceId, x);
await Task.Delay(1000);
Logger.LogDebug("result {}", JsonSerializer.Serialize(result)); Logger.LogDebug("result {}", JsonSerializer.Serialize(result));
Toaster.ShowInfo("Sådan!"); Toaster.ClearWarningToasts();
Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}"); Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}");
Working = false; Working = false;
} }

View file

@ -1,7 +1,7 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Online", "name": "Wonky Online",
"version": "228.0", "version": "230.0",
"rc": true, "rc": true,
"sandBox": true, "sandBox": true,
"image": "grumpy-coder.png", "image": "grumpy-coder.png",