Skip to content

Commit 277d272

Browse files
Revert "feat(mf-tools): enhance connectRouter to support baseHref for URL navigation"
This reverts commit bc286f6.
1 parent f8ae21c commit 277d272

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

libs/mf-tools/src/lib/web-components/bootstrap-utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import {
77
PlatformRef,
88
Type,
99
Version,
10-
VERSION,
1110
} from '@angular/core';
1211
import { platformBrowser } from '@angular/platform-browser';
13-
import { APP_BASE_HREF } from '@angular/common';
12+
import { VERSION } from '@angular/core';
1413
import {
1514
getGlobalStateSlice,
1615
setGlobalStateSlice,
@@ -212,13 +211,12 @@ function shareShellZone(injector: Injector) {
212211

213212
function connectMicroFrontendRouter(injector: Injector) {
214213
const router = injector.get(Router);
215-
const baseHref = injector.get(APP_BASE_HREF, '');
216214
const useHash = location.href.includes('#');
217215

218216
if (!router) {
219217
console.warn('No router to connect found');
220218
return;
221219
}
222220

223-
connectRouter(router, useHash, baseHref);
221+
connectRouter(router, useHash);
224222
}

libs/mf-tools/src/lib/web-components/router-utils.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,10 @@ export function endsWith(prefix: string): UrlMatcher {
2020
};
2121
}
2222

23-
export function connectRouter(
24-
router: Router,
25-
useHash = false,
26-
baseHref?: string
27-
): void {
23+
export function connectRouter(router: Router, useHash = false): void {
2824
let url: string;
2925
if (!useHash) {
3026
url = `${location.pathname.substring(1)}${location.search}`;
31-
if (baseHref && url.startsWith(baseHref)) {
32-
url = url.replace(baseHref, '');
33-
}
3427
router.navigateByUrl(url);
3528
window.addEventListener('popstate', () => {
3629
router.navigateByUrl(url);

0 commit comments

Comments
 (0)