-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the trailing-history location locally with support for query params
until empress/guidemaker#117 is merged and released
- Loading branch information
1 parent
34d3a95
commit 2d3ce8d
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* TODO: Remove this after the upstream PR to allow query params with the trailing history location is merged | ||
* https://github.com/empress/guidemaker/pull/117 | ||
*/ | ||
|
||
/* eslint-disable ember/no-classic-classes, prettier/prettier */ | ||
import HistoryLocation from '@ember/routing/history-location'; | ||
|
||
export default HistoryLocation.extend({ | ||
formatURL() { | ||
let url = this._super(...arguments); | ||
return formatURL(url); | ||
}, | ||
}); | ||
|
||
export function formatURL(url) { | ||
let modifiedURL = new URL(url, 'http://example.com'); | ||
modifiedURL.pathname += '/'; | ||
return `${modifiedURL.pathname}${modifiedURL.search}${modifiedURL.hash}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters