summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src/components/PJAXWrapper.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core/src/components/PJAXWrapper.js')
-rw-r--r--packages/gitbook-core/src/components/PJAXWrapper.js16
1 files changed, 3 insertions, 13 deletions
diff --git a/packages/gitbook-core/src/components/PJAXWrapper.js b/packages/gitbook-core/src/components/PJAXWrapper.js
index f35a554..d2eb456 100644
--- a/packages/gitbook-core/src/components/PJAXWrapper.js
+++ b/packages/gitbook-core/src/components/PJAXWrapper.js
@@ -1,6 +1,6 @@
const React = require('react');
const ReactRedux = require('react-redux');
-const navigation = require('../actions/navigation');
+const Navigation = require('../actions/navigation');
/**
* Check if an element is inside a link
@@ -61,7 +61,7 @@ function getHrefForEvent(event) {
if (link.getAttribute('data-nopjax'))
return;
- return link.href;
+ return link.pathname;
}
/*
@@ -83,25 +83,15 @@ const PJAXWrapper = React.createClass({
}
event.preventDefault();
- dispatch(navigation.fetchPage(href));
-
- },
-
- onPopState(event) {
- const { dispatch } = this.props;
- event.preventDefault();
-
- dispatch(navigation.fetchPage(location.href, { replace: true }));
+ dispatch(Navigation.push(href));
},
componentDidMount() {
document.addEventListener('click', this.onClick, false);
- window.addEventListener('popstate', this.onPopState, false);
},
componentWillUnmount() {
document.removeEventListener('click', this.onClick, false);
- window.removeEventListener('popstate', this.onPopState, false);
},
render() {