client/posts: strip junk from post permalinks

Thanks for inspiration, StackExchange
This commit is contained in:
rr-
2016-07-07 22:13:58 +02:00
parent 5ac5eb5503
commit 8901658c17
2 changed files with 18 additions and 4 deletions

View File

@ -5,6 +5,7 @@
// - refactored to classes
// - simplified method chains
// - added ability to call .save() in .exit() without side effects
// - page refresh recovers state from history
const pathToRegexp = require('path-to-regexp');
const clickEvent = document.ontouchstart ? 'touchstart' : 'click';
@ -121,7 +122,7 @@ class Router {
window.addEventListener('popstate', this._onPopState, false);
document.addEventListener(clickEvent, this._onClick, false);
const url = location.pathname + location.search + location.hash;
return this.replace(url, null, true);
return this.replace(url, history.state, true);
}
stop() {