diff --git a/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts b/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts index 36c88357c3..91fff747cd 100644 --- a/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts +++ b/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts @@ -20,6 +20,13 @@ import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registr @customElement('umb-app') export class UmbAppElement extends UmbLitElement { + /** + * Backoffice extension registry. + * This enables to register and unregister extensions via DevTools, or just via querying this element via the DOM. + * @type {UmbExtensionsRegistry} + */ + public extensionRegistry = umbExtensionsRegistry; + /** * The base URL of the configured Umbraco server. * @@ -69,7 +76,7 @@ export class UmbAppElement extends UmbLitElement { #umbIconRegistry = new UmbIconRegistry(); #uuiIconRegistry = new UUIIconRegistryEssential(); #serverConnection?: UmbServerConnection; - #authController = new UmbAppAuthController(this); + #authController?: UmbAppAuthController; constructor() { super(); @@ -91,6 +98,7 @@ export class UmbAppElement extends UmbLitElement { } async #setup() { + this.#authController = new UmbAppAuthController(this); this.#serverConnection = await new UmbServerConnection(this.serverUrl).connect(); this.#authContext = new UmbAuthContext(this, this.serverUrl, this.backofficePath, this.bypassAuth); @@ -191,7 +199,7 @@ export class UmbAppElement extends UmbLitElement { } #isAuthorizedGuard(): Guard { - return () => this.#authController.isAuthorized(); + return () => this.#authController?.isAuthorized() ?? false; } #errorPage(errorMsg: string, error?: unknown) { diff --git a/src/Umbraco.Web.UI.Client/src/apps/backoffice/backoffice.element.ts b/src/Umbraco.Web.UI.Client/src/apps/backoffice/backoffice.element.ts index 407e04a759..5e42145a82 100644 --- a/src/Umbraco.Web.UI.Client/src/apps/backoffice/backoffice.element.ts +++ b/src/Umbraco.Web.UI.Client/src/apps/backoffice/backoffice.element.ts @@ -38,13 +38,6 @@ const CORE_PACKAGES = [ @customElement('umb-backoffice') export class UmbBackofficeElement extends UmbLitElement { - /** - * Backoffice extension registry. - * This enables to register and unregister extensions via DevTools, or just via querying this element via the DOM. - * @type {UmbExtensionsRegistry} - */ - public extensionRegistry = umbExtensionsRegistry; - constructor() { super();