62 lines
1.7 KiB
Plaintext
62 lines
1.7 KiB
Plaintext
@inject IInstallationService InstallationService
|
|
@inject IJSRuntime JSRuntime
|
|
@inject SiteState SiteState
|
|
|
|
@if (_initialized)
|
|
{
|
|
@if (!_installation.Success)
|
|
{
|
|
<Installer />
|
|
}
|
|
else
|
|
{
|
|
@if (string.IsNullOrEmpty(_installation.Message))
|
|
{
|
|
<CascadingAuthenticationState>
|
|
<CascadingValue Value="@PageState">
|
|
<SiteRouter OnStateChange="@ChangeState" />
|
|
</CascadingValue>
|
|
</CascadingAuthenticationState>
|
|
}
|
|
else
|
|
{
|
|
<div class="app-alert">
|
|
@_installation.Message
|
|
</div>
|
|
}
|
|
}
|
|
}
|
|
|
|
@code {
|
|
private bool _initialized = false;
|
|
private Installation _installation = new Installation { Success = false, Message = "" };
|
|
|
|
private PageState PageState { get; set; }
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender && !_initialized)
|
|
{
|
|
var interop = new Interop(JSRuntime);
|
|
SiteState.AntiForgeryToken = await interop.GetElementByName(Constants.RequestVerificationToken);
|
|
_installation = await InstallationService.IsInstalled();
|
|
if (_installation.Alias != null)
|
|
{
|
|
SiteState.Alias = _installation.Alias;
|
|
}
|
|
else
|
|
{
|
|
_installation.Message = "Site Not Configured Correctly - No Matching Alias Exists For Host Name";
|
|
}
|
|
_initialized = true;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
private void ChangeState(PageState pageState)
|
|
{
|
|
PageState = pageState;
|
|
StateHasChanged();
|
|
}
|
|
}
|