🪢 Wired up the updated Elasticsearch call to the potential matches page
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
"ellipsize": "^0.1.0",
|
"ellipsize": "^0.1.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fastest-validator": "^1.11.0",
|
"fastest-validator": "^1.11.0",
|
||||||
"filename-parser": "^1.0.1",
|
"filename-parser": "^1.0.2",
|
||||||
"final-form": "^4.20.2",
|
"final-form": "^4.20.2",
|
||||||
"final-form-arrays": "^3.0.2",
|
"final-form-arrays": "^3.0.2",
|
||||||
"html-to-text": "^8.1.0",
|
"html-to-text": "^8.1.0",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { isEmpty, extend, each } from "lodash";
|
import { isEmpty, extend, each, matches } from "lodash";
|
||||||
import {
|
import {
|
||||||
CV_API_CALL_IN_PROGRESS,
|
CV_API_CALL_IN_PROGRESS,
|
||||||
CV_SEARCH_SUCCESS,
|
CV_SEARCH_SUCCESS,
|
||||||
@@ -71,19 +71,30 @@ function comicinfoReducer(state = initialState, action) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
case CV_ISSUES_FOR_VOLUME_IN_LIBRARY_SUCCESS:
|
case CV_ISSUES_FOR_VOLUME_IN_LIBRARY_SUCCESS:
|
||||||
// console.log("jagan", action);
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
issuesForVolume: action.issues,
|
issuesForVolume: action.issues,
|
||||||
inProgress: false,
|
inProgress: false,
|
||||||
};
|
};
|
||||||
case CV_ISSUES_MATCHES_IN_LIBRARY_FETCHED:
|
|
||||||
console.log(action);
|
|
||||||
const updatedState = [...state.issuesForVolume];
|
|
||||||
|
|
||||||
// updatedState[issueToUpdateIndex].matches = action.result.matches;
|
case CV_ISSUES_MATCHES_IN_LIBRARY_FETCHED:
|
||||||
// console.log(issueToUpdateIndex);
|
const updatedState = [...state.issuesForVolume];
|
||||||
// console.log(updatedState[issueToUpdateIndex]);
|
const matches = action.matches.filter(
|
||||||
|
(match) => !isEmpty(match.hits.hits),
|
||||||
|
);
|
||||||
|
matches.forEach((match) => {
|
||||||
|
state.issuesForVolume.forEach((issue, idx) => {
|
||||||
|
issue.matches = [];
|
||||||
|
match.hits.hits.forEach((hit) => {
|
||||||
|
if (
|
||||||
|
parseInt(issue.issue_number, 10) ===
|
||||||
|
hit._source.inferredMetadata.issue.number
|
||||||
|
) {
|
||||||
|
issue.matches.push(hit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|||||||
Reference in New Issue
Block a user