AppSettings.ApiUrl

This commit is contained in:
2023-01-19 16:45:16 -07:00
parent a4d3a9899f
commit 10c823dca8
10 changed files with 202 additions and 39 deletions

View File

@ -7,6 +7,7 @@ public partial class AwaitingDisposition
{
[Inject] protected IJSRuntime? JSRuntime { get; set; }
[Inject] protected Models.AppSettings? AppSettings { get; set; }
protected override Task OnAfterRenderAsync(bool firstRender)
{
@ -14,7 +15,9 @@ public partial class AwaitingDisposition
{
if (JSRuntime is null)
throw new NullReferenceException(nameof(JSRuntime));
return JSRuntime.InvokeVoidAsync("initAwaitingDisposition").AsTask();
if (AppSettings is null)
throw new NullReferenceException(nameof(AppSettings));
return JSRuntime.InvokeVoidAsync("initAwaitingDisposition", AppSettings.ApiUrl).AsTask();
}
return Task.CompletedTask;
}

View File

@ -7,6 +7,7 @@ public partial class Export
{
[Inject] protected IJSRuntime? JSRuntime { get; set; }
[Inject] protected Models.AppSettings? AppSettings { get; set; }
[Parameter] public Metrology.Shared.ViewModels.Export? Model { get; set; }
public Export()
@ -25,7 +26,9 @@ public partial class Export
{
if (JSRuntime is null)
throw new NullReferenceException(nameof(JSRuntime));
return JSRuntime.InvokeVoidAsync("initExport", DateTime.Now.AddMonths(-1), DateTime.Now).AsTask();
if (AppSettings is null)
throw new NullReferenceException(nameof(AppSettings));
return JSRuntime.InvokeVoidAsync("initExport", AppSettings.ApiUrl, DateTime.Now.AddMonths(-1), DateTime.Now).AsTask();
}
return Task.CompletedTask;
}

View File

@ -7,6 +7,7 @@ public partial class RunHeaders
{
[Inject] protected IJSRuntime? JSRuntime { get; set; }
[Inject] protected Models.AppSettings? AppSettings { get; set; }
protected override Task OnAfterRenderAsync(bool firstRender)
{
@ -14,7 +15,9 @@ public partial class RunHeaders
{
if (JSRuntime is null)
throw new NullReferenceException(nameof(JSRuntime));
return JSRuntime.InvokeVoidAsync("initRunHeaders").AsTask();
if (AppSettings is null)
throw new NullReferenceException(nameof(AppSettings));
return JSRuntime.InvokeVoidAsync("initRunHeaders", AppSettings.ApiUrl).AsTask();
}
return Task.CompletedTask;
}

View File

@ -9,6 +9,7 @@ public partial class RunInfo
[Parameter] public Metrology.Shared.ViewModels.RunInfo? Model { get; set; }
[Inject] protected IJSRuntime? JSRuntime { get; set; }
[Inject] protected Models.AppSettings? AppSettings { get; set; }
protected override Task OnAfterRenderAsync(bool firstRender)
{
@ -16,10 +17,12 @@ public partial class RunInfo
{
if (JSRuntime is null)
throw new NullReferenceException(nameof(JSRuntime));
if (AppSettings is null)
throw new NullReferenceException(nameof(AppSettings));
int initialToolTypeID = Model is not null ? Model.ToolTypeID : 0;
int initialHeaderId = Model is not null ? Model.HeaderID : 0;
string initialHeaderAttachmentId = Model is not null ? Model.HeaderAttachmentID.ToString() : string.Empty;
return JSRuntime.InvokeVoidAsync("initRunInfo", initialToolTypeID, initialHeaderId, initialHeaderAttachmentId).AsTask();
return JSRuntime.InvokeVoidAsync("initRunInfo", AppSettings.ApiUrl, initialToolTypeID, initialHeaderId, initialHeaderAttachmentId).AsTask();
}
return Task.CompletedTask;
}