|
| 1 | +@inherits LayoutComponentBase |
| 2 | +@inject IServiceGatewayFactory GatewayFactory |
| 3 | + |
| 4 | +<script>window.Server = @metadataHtml</script> |
| 5 | +<script type="module"> |
| 6 | +import { useAuth, useMetadata } from "@@servicestack/vue" |
| 7 | +const { signIn } = useAuth() |
| 8 | +signIn(@authJson) |
| 9 | +
|
| 10 | +const { loadMetadata } = useMetadata() |
| 11 | +loadMetadata({ |
| 12 | + olderThan: null |
| 13 | +}) |
| 14 | +</script> |
| 15 | + |
| 16 | +<div class="min-h-screen"> |
| 17 | + <Header /> |
| 18 | + |
| 19 | + <main role="main"> |
| 20 | + @Body |
| 21 | + </main> |
| 22 | +</div> |
| 23 | + |
| 24 | +<script type="module"> |
| 25 | +import { remount } from "/mjs/app.mjs" |
| 26 | +remount() |
| 27 | +</script> |
| 28 | + |
| 29 | +<div id="blazor-error-ui" class="hidden fixed bottom-0 w-full z-10"> |
| 30 | + <div class="flex rounded-md bg-yellow-50 p-4 m-4"> |
| 31 | + <div class="flex-shrink-0"> |
| 32 | + <!-- Heroicon name: solid/exclamation --> |
| 33 | + <svg class="h-5 w-5 text-yellow-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> |
| 34 | + <path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" /> |
| 35 | + </svg> |
| 36 | + </div> |
| 37 | + <div class="ml-3"> |
| 38 | + <environment include="Staging,Production"> |
| 39 | + <h3 class="text-sm font-medium text-yellow-800">An error has occurred. This application may no longer respond until reloaded.</h3> |
| 40 | + </environment> |
| 41 | + <environment include="Development"> |
| 42 | + <h3 class="text-sm font-medium text-yellow-800">An unhandled exception has occurred. See browser dev tools for details.</h3> |
| 43 | + </environment> |
| 44 | + <div class="mt-4"> |
| 45 | + <div class="-mx-2 -my-1.5 flex"> |
| 46 | + <button type="button" class="reload bg-yellow-50 px-2 py-1.5 rounded-md text-sm font-medium text-yellow-800 hover:bg-yellow-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-yellow-50 focus:ring-yellow-600">Reload</button> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | + <div class="ml-auto pl-3"> |
| 51 | + <div class="-mx-1.5 -my-1.5"> |
| 52 | + <button type="button" class="dismiss inline-flex bg-yellow-50 rounded-md p-1.5 text-yellow-500 hover:bg-yellow-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-yellow-50 focus:ring-yellow-600"> |
| 53 | + <span class="sr-only">Dismiss</span> |
| 54 | + <!-- Heroicon name: solid/x --> |
| 55 | + <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> |
| 56 | + <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" /> |
| 57 | + </svg> |
| 58 | + </button> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + </div> |
| 62 | +</div> |
| 63 | + |
| 64 | +@code { |
| 65 | + MarkupString? metadataHtml = null; |
| 66 | + MarkupString? authJson = null; |
| 67 | + [CascadingParameter] |
| 68 | + private HttpContext HttpContext { get; set; } = default!; |
| 69 | + |
| 70 | + protected override async Task OnInitializedAsync() |
| 71 | + { |
| 72 | + await base.OnInitializedAsync(); |
| 73 | + var gateway = GatewayFactory.GetServiceGateway(HttpContext.ToRequest()); |
| 74 | + metadataHtml = await gateway.ApiAsJsonAsync(new MetadataApp()); |
| 75 | + authJson = await gateway.ApiAsJsonAsync(new Authenticate()); |
| 76 | + } |
| 77 | +} |
0 commit comments