Skip to content

Commit

Permalink
Fix hash replacement redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
microbouji committed Apr 1, 2018
1 parent f147077 commit 7324006
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/createHashHistory.js
Expand Up @@ -45,11 +45,11 @@ const getHashPath = () => {
const pushHashPath = path => (window.location.hash = path);

const replaceHashPath = path => {
const hashIndex = window.location.href.indexOf("#");
let href = window.location.href;
const hashIndex = href.indexOf("#");
if (hashIndex !== -1) href = href.slice(0, hashIndex);

window.location.replace(
window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + "#" + path
);
window.location.replace(href + "#" + path);
};

const createHashHistory = (props = {}) => {
Expand Down

0 comments on commit 7324006

Please sign in to comment.