Update url checking logic.

This commit is contained in:
Mike Cao 2020-09-10 21:12:04 -07:00
parent 8b9c3350b2
commit 4ae7ad35ff

View File

@ -58,14 +58,14 @@ import { removeTrailingSlash } from '../lib/url';
/* Handle history */ /* Handle history */
const handlePush = (state, title, navigatedURL) => { const handlePush = (state, title, url) => {
removeEvents(); removeEvents();
currentRef = currentUrl; currentRef = currentUrl;
const newUrl = navigatedURL.toString(); const newUrl = url.toString();
if (newUrl.startsWith('http')) { if (newUrl.substring(0, 4) === 'http') {
const url = new URL(newUrl); const { pathname, search } = new URL(newUrl);
currentUrl = `${url.pathname}${url.search}`; currentUrl = `${pathname}${search}`;
} else { } else {
currentUrl = newUrl; currentUrl = newUrl;
} }