Routes.razor 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. @using RackPeek.Domain.Helpers
  2. @using RackPeek.Domain.Persistence
  3. @using RackPeek.Web.Components.Pages
  4. @using Shared.Rcl.Servers
  5. @inject IResourceCollection Resources
  6. @if (!_ready)
  7. {
  8. <p>Loading…</p>
  9. }
  10. else
  11. {
  12. <Router AppAssembly="@typeof(App).Assembly"
  13. AdditionalAssemblies="new[] { typeof(ServersListPage).Assembly }"
  14. NotFoundPage="typeof(NotFound)">
  15. <Found Context="routeData">
  16. <RouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)"/>
  17. </Found>
  18. </Router>
  19. }
  20. @code {
  21. private bool _ready;
  22. protected override async Task OnInitializedAsync()
  23. {
  24. try
  25. {
  26. await Resources.LoadAsync();
  27. }
  28. catch (ConfigLoadException)
  29. {
  30. // A damaged config must not leave the app stuck on "Loading…" — the YAML
  31. // editor is how someone repairs it. Pages that read the inventory surface
  32. // the failure themselves; they can no longer report it as empty (#337).
  33. }
  34. _ready = true;
  35. }
  36. }