level up methods

This commit is contained in:
Niels Lyngsø
2024-03-08 11:43:30 +01:00
parent 1c769a4e12
commit 2a3ed74402

View File

@@ -31,6 +31,19 @@ export class UmbRouteContext extends UmbControllerBase {
});
}
public navigateLevelUp() {
const path = this.getLevelUpPath();
if (path) {
window.history.pushState({}, '', path);
}
}
public getLevelUpPath() {
if (this.#routerBasePath) {
return this.#routerBasePath.endsWith('/') ? this.#routerBasePath : this.#routerBasePath + '/';
}
return;
}
public registerModal(registration: UmbModalRouteRegistration) {
this.#modalRegistrations.push(registration);
this.#createNewUrlBuilder(registration);