Skip to content

Commit

Permalink
feat: deploymentPath used to determine whole prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
markuczy committed Jul 1, 2024
1 parent 8322b12 commit eaefd7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions libs/angular-webcomponents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@angular/platform-browser": "^15.2.7 || ^16.0.0 || ^17.0.0",
"@angular/elements": "^15.2.7 || ^16.0.0 || ^17.0.0",
"@angular/router": "^15.2.7 || ^16.0.0 || ^17.0.0",
"@onecx/accelerator": "^4",
"@onecx/portal-integration-angular": "^4",
"rxjs": "~7.8.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Route, UrlMatcher, UrlSegment, UrlSegmentGroup } from '@angular/router'
import { getLocation } from '@onecx/accelerator'

export function startsWith(prefix: string): UrlMatcher {
return (url: UrlSegment[], UrlSegmentGroup: UrlSegmentGroup, route: Route) => {
Expand All @@ -21,10 +22,8 @@ export function sliceBaseHref(route: Route, url: UrlSegment[]): UrlSegment[] {
)
}

const fullUrl = '/' + url.map((u) => u).join('/') + '/'
const mfeBaseHrefStartindex = fullUrl.indexOf(mfeBaseHref)
const baseHrefSegmentAmount = fullUrl
.slice(0, mfeBaseHrefStartindex + mfeBaseHref.length)
const baseHrefSegmentAmount = getLocation()
.deploymentPath.concat(mfeBaseHref)
.split('/')
.filter((value) => value).length
return url.slice(baseHrefSegmentAmount)
Expand Down

0 comments on commit eaefd7c

Please sign in to comment.