Skip to content
Snippets Groups Projects
Commit e964aa74 authored by esikkala's avatar esikkala
Browse files

Update page with result class

parent 94cc54b3
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,9 @@ export const sortResults = sortBy => ({
type: SORT_RESULTS,
sortBy
});
export const updatePage = page => ({
export const updatePage = (resultClass, page) => ({
type: UPDATE_PAGE,
page
resultClass, page
});
export const fetchResultsFailed = error => ({
type: FETCH_RESULTS_FAILED,
......
......@@ -154,7 +154,6 @@ class LeafletMap extends React.Component {
}
if (this.props.instance !== instance) {
console.log(instance)
this.markers[this.props.instance.id]
.bindPopup(this.createPopUpContent(this.props.instance), {
maxHeight: 300,
......
......@@ -22,11 +22,11 @@ let Manuscripts = props => {
value: 1,
icon: 'AddLocation',
},
'/manuscripts/migrations': {
label: 'migrations',
value: 2,
icon: 'Redo',
}
// '/manuscripts/migrations': {
// label: 'migrations',
// value: 2,
// icon: 'Redo',
// }
}}
/>
<Route
......
......@@ -54,7 +54,7 @@ class ResultTable extends React.Component {
page = parseInt(parse(this.props.routeProps.location.search).page);
// console.log(`result table mounted with page parameter, set page to ${page}`);
}
this.props.updatePage(page);
this.props.updatePage(this.props.resultClass, page);
}
componentDidUpdate = prevProps => {
......@@ -66,13 +66,13 @@ class ResultTable extends React.Component {
});
}
if (prevProps.filters != this.props.filters) {
this.props.updatePage(0);
this.props.updatePage(this.props.resultClass, 0);
if (this.props.data.page == 0) {
this.props.fetchResults(this.props.resultClass, this.props.facetClass, null);
}
}
if (prevProps.data.sortBy != this.props.data.sortBy) {
this.props.updatePage(0);
this.props.updatePage(this.props.resultClass, 0);
if (this.props.data.page == 0) {
this.props.fetchResults(this.props.resultClass, this.props.facetClass, null);
}
......@@ -84,7 +84,7 @@ class ResultTable extends React.Component {
handleChangePage = (event, page) => {
if (event != null) {
this.props.updatePage(page);
this.props.updatePage(this.props.resultClass, page);
}
}
......
......@@ -89,36 +89,36 @@ export const INITIAL_STATE = {
};
const manuscripts = (state = INITIAL_STATE, action) => {
switch (action.type) {
case FETCH_RESULTS:
return { ...state, fetching: true };
case FETCH_BY_URI:
return { ...state, fetching: true };
case SORT_RESULTS:
return updateSortBy(state, action);
case UPDATE_RESULTS:
if (action.resultClass === 'manuscripts') {
if (action.resultClass === 'manuscripts') {
switch (action.type) {
case FETCH_RESULTS:
return { ...state, fetching: true };
case FETCH_BY_URI:
return { ...state, fetching: true };
case SORT_RESULTS:
return updateSortBy(state, action);
case UPDATE_RESULTS:
return {
...state,
resultCount: parseInt(action.data.resultCount),
results: action.data.results,
fetching: false
};
} else return state;
case UPDATE_INSTANCE:
return {
...state,
instance: action.instance,
fetchingPlaces: false
};
case UPDATE_PAGE:
return {
...state,
page: action.page
};
default:
return state;
}
case UPDATE_INSTANCE:
return {
...state,
instance: action.instance,
fetchingPlaces: false
};
case UPDATE_PAGE:
return {
...state,
page: action.page
};
default:
return state;
}
} else return state;
};
export default manuscripts;
......@@ -67,7 +67,6 @@ const places = (state = INITIAL_STATE, action) => {
fetching: false
};
case UPDATE_INSTANCE:
console.log(action)
return {
...state,
instance: action.instance,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment