🪢 Unwrangling state vars for global search vs local

This commit is contained in:
2022-08-18 00:10:31 -07:00
parent 5f59456c8b
commit 9bbf2efc3c
6 changed files with 50 additions and 14 deletions

View File

@@ -44,7 +44,7 @@ const initialState = {
extractedComicBookArchive: [],
recentComics: [],
wantedComics: [],
librarySearchResults: [],
libraryComics: [],
librarySearchResultsFormatted: [],
librarySearchResultCount: 0,
libraryQueueResults: [],
@@ -190,12 +190,13 @@ function fileOpsReducer(state = initialState, action) {
case SS_SEARCH_RESULTS_FETCHED: {
return {
...state,
librarySearchResults: action.data,
libraryComics: action.data,
SSCallInProgress: false,
};
}
case SS_SEARCH_RESULTS_FETCHED_SPECIAL: {
const foo = [];
console.log(action.data.hits)
if (!isUndefined(action.data.hits)) {
map(action.data.hits.hits, ({ _source }) => {
foo.push(_source);
@@ -207,6 +208,19 @@ function fileOpsReducer(state = initialState, action) {
SSCallInProgress: false,
};
}
case WANTED_COMICS_FETCHED: {
const foo = [];
if (!isUndefined(action.data.hits)) {
map(action.data.hits.hits, ({ _source }) => {
foo.push(_source);
});
}
return {
...state,
wantedComics: foo,
SSCallInProgress: false,
};
}
case SS_SEARCH_FAILED: {
return {