/ GUNRPG.WebClient / AuthInitializer.razor
AuthInitializer.razor
 1  @inject AuthService Auth
 2  
 3  @if (!_initialized)
 4  {
 5      <div style="display:flex; justify-content:center; align-items:center; height:100vh;">
 6          <FluentProgressRing />
 7      </div>
 8  }
 9  else
10  {
11      @ChildContent
12  }
13  
14  @code {
15      [Parameter] public RenderFragment ChildContent { get; set; } = null!;
16  
17      private bool _initialized;
18  
19      protected override async Task OnInitializedAsync()
20      {
21          try
22          {
23              await Auth.TryRestoreAsync();
24          }
25          finally
26          {
27              _initialized = true;
28          }
29      }
30  }