{ isFetching &&
}
- {children}
+
+
+
+ ()} />
+
+
+
+
diff --git a/src/containers/CollectionPage.js b/src/containers/CollectionPage.js
index e3418493..e1762bd8 100644
--- a/src/containers/CollectionPage.js
+++ b/src/containers/CollectionPage.js
@@ -68,7 +68,7 @@ class CollectionPage extends React.Component {
function mapStateToProps(state, ownProps) {
const { collections, config } = state;
- const { name, slug } = ownProps.params;
+ const { name } = ownProps.match.params;
const publicFolder = config.get('public_folder');
const collection = name ? collections.get(name) : collections.first();
const page = state.entries.getIn(['pages', collection.get('name'), 'page']);
@@ -76,7 +76,7 @@ function mapStateToProps(state, ownProps) {
const entries = selectEntries(state, collection.get('name'));
const isFetching = state.entries.getIn(['pages', collection.get('name'), 'isFetching'], false);
- return { slug, publicFolder, collection, collections, page, entries, isFetching };
+ return { publicFolder, collection, collections, page, entries, isFetching };
}
export default connect(mapStateToProps)(CollectionPage);
diff --git a/src/containers/EntryPage.js b/src/containers/EntryPage.js
index c9e83647..35337978 100644
--- a/src/containers/EntryPage.js
+++ b/src/containers/EntryPage.js
@@ -56,11 +56,10 @@ class EntryPage extends React.Component {
loadEntry(collection, slug);
}
- this.unlisten = history.listenBefore((location) => {
+ this.unblock = history.block((location) => {
if (this.props.entryDraft.get('hasChanged')) {
return "Are you sure you want to leave this page?";
}
- return true;
});
}
@@ -84,7 +83,7 @@ class EntryPage extends React.Component {
componentWillUnmount() {
this.props.discardDraft();
- this.unlisten();
+ this.unblock();
}
createDraft = (entry) => {
@@ -161,9 +160,9 @@ class EntryPage extends React.Component {
function mapStateToProps(state, ownProps) {
const { collections, entryDraft } = state;
- const slug = ownProps.params.slug;
- const collection = collections.get(ownProps.params.name);
- const newEntry = ownProps.route && ownProps.route.newRecord === true;
+ const slug = ownProps.match.params.slug;
+ const collection = collections.get(ownProps.match.params.name);
+ const newEntry = ownProps.newRecord === true;
const fields = selectFields(collection, slug);
const entry = newEntry ? null : selectEntry(state, collection.get('name'), slug);
const boundGetAsset = getAsset.bind(null, state);
diff --git a/src/containers/SearchPage.js b/src/containers/SearchPage.js
index 43dae8ef..e27d5721 100644
--- a/src/containers/SearchPage.js
+++ b/src/containers/SearchPage.js
@@ -67,7 +67,7 @@ function mapStateToProps(state, ownProps) {
const entries = selectSearchedEntries(state);
const collections = state.collections.toIndexedSeq();
const publicFolder = state.config.get('public_folder');
- const searchTerm = ownProps.params && ownProps.params.searchTerm;
+ const { searchTerm } = ownProps.match.params;
return { isFetching, page, collections, entries, publicFolder, searchTerm };
}
diff --git a/src/root.js b/src/root.js
index 6c07d1f1..1fb54a99 100644
--- a/src/root.js
+++ b/src/root.js
@@ -1,23 +1,21 @@
import React from 'react';
import { Provider } from 'react-redux';
-import { Router } from 'react-router';
-import routes from './routing/routes';
-import history, { syncHistory } from './routing/history';
+import { Route } from 'react-router-dom';
+import { ConnectedRouter } from 'react-router-redux';
+import history from './routing/history';
import configureStore from './redux/configureStore';
import { setStore } from './valueObjects/AssetProxy';
+import App from './containers/App';
const store = configureStore();
-// Create an enhanced history that syncs navigation events with the store
-syncHistory(store);
-
setStore(store);
const Root = () => (