diff --git a/app/locations/trailing-history.js b/app/locations/trailing-history.js new file mode 100644 index 0000000000..3f12264be4 --- /dev/null +++ b/app/locations/trailing-history.js @@ -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}`; +}