Skip to content

Commit

Permalink
Add the trailing-history location locally with support for query params
Browse files Browse the repository at this point in the history
until empress/guidemaker#117 is merged and
released
  • Loading branch information
kategengler committed Dec 17, 2024
1 parent 34d3a95 commit b6d0509
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/locations/trailing-history.js
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}`;
}

0 comments on commit b6d0509

Please sign in to comment.