check for backoffice path

This commit is contained in:
Mads Rasmussen
2024-05-27 16:17:45 +02:00
parent 40543c199e
commit 6d4ec730b1

View File

@@ -9,6 +9,7 @@ import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
import { umbLocalizationRegistry } from '@umbraco-cms/backoffice/localization';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_SECTION_PATH_PATTERN } from '@umbraco-cms/backoffice/section';
import { UMB_APP_CONTEXT } from '@umbraco-cms/backoffice/app';
export class UmbCurrentUserContext extends UmbContextBase<UmbCurrentUserContext> {
#currentUser = new UmbObjectState<UmbCurrentUserModel | undefined>(undefined);
@@ -82,7 +83,10 @@ export class UmbCurrentUserContext extends UmbContextBase<UmbCurrentUserContext>
async #redirectToFirstAllowedSectionIfNeeded() {
const url = new URL(window.location.href);
if (url.pathname === '/') {
const appContext = await this.getContext(UMB_APP_CONTEXT);
const backofficePath = appContext.getBackofficePath();
if (url.pathname === backofficePath) {
const sectionManifest = await this.#firstAllowedSection();
if (!sectionManifest) return;