@@ -191,11 +189,11 @@ class Search extends Component {
const AsyncSearch = asyncConnect([{
promise({ store: { dispatch }, location }) {
if (__CLIENT__) {
- dispatch(search(location.query));
+ dispatch(search(location.query || location.q));
return false;
}
- return dispatch(search(location.query));
+ return dispatch(search(location.query || location.q));
}
}])(Search);
@@ -203,14 +201,13 @@ function mapStateToProps(state) {
return {
isErrored: state.searchResults.errored,
isLoading: state.searchResults.loading,
- total: state.searchResults.total,
- page: state.searchResults.page,
- size: state.searchResults.size,
- from: state.searchResults.from,
+ totalCount: state.searchResults.totalCount,
+ currentPage: state.searchResults.currentPage,
+ totalPages: state.searchResults.totalPages,
+ perPage: state.searchResults.perPage,
took: state.searchResults.took,
query: state.searchResults.query,
results: state.searchResults.results,
- verses: state.searchResults.entities,
options: state.options
};
}
diff --git a/src/redux/actions/search.js b/src/redux/actions/search.js
index 2efdf3fd5..475d7a45c 100644
--- a/src/redux/actions/search.js
+++ b/src/redux/actions/search.js
@@ -9,7 +9,7 @@ import {
export function search(params) {
return {
types: [SEARCH, SEARCH_SUCCESS, SEARCH_FAIL],
- schema: { results: [{ ayah: versesSchema }] },
+ schema: { results: [versesSchema] },
// TODO: We are doing this because of a weird obj.hasOwnProperty method missing on `params`
promise: client => client.get('/api/v3/search', { params: { q: params.q, p: params.p } }),
params
diff --git a/src/redux/modules/searchResults.js b/src/redux/modules/searchResults.js
index 7451f8d51..9935987c2 100644
--- a/src/redux/modules/searchResults.js
+++ b/src/redux/modules/searchResults.js
@@ -7,7 +7,6 @@ import {
const initialState = {
errored: false,
loaded: false,
- entities: {},
results: []
};
@@ -27,14 +26,13 @@ export default function reducer(state = initialState, action = {}) {
loaded: true,
loading: false,
errored: false,
- total: action.result.result.total,
- page: action.result.result.page,
- size: action.result.result.size,
- from: action.result.result.from,
+ totalCount: action.result.result.totalCount,
+ totalPages: action.result.result.totalPages,
+ currentPage: action.result.result.currentPage,
+ perPage: action.result.result.perPage,
took: action.result.result.took,
query: action.result.result.query,
- results: action.result.result.results,
- entities: Object.assign({}, state.entities, action.result.entities.verses)
+ results: action.result.result.results
};
case SEARCH_FAIL:
return {