🤼‍♀️ Ability to apply a select ComicVine match first draft

This commit is contained in:
2021-08-06 13:43:42 -07:00
parent 8df48ea6ae
commit b2fb21146d
10 changed files with 267 additions and 123 deletions

View File

@@ -5,6 +5,9 @@ import {
CV_SEARCH_SUCCESS,
CV_API_CALL_IN_PROGRESS,
CV_API_GENERIC_FAILURE,
IMS_COMIC_BOOK_DB_OBJECT_CALL_IN_PROGRESS,
IMS_COMIC_BOOK_DB_OBJECT_CALL_FAILED,
IMS_COMIC_BOOK_DB_OBJECT_FETCHED,
} from "../constants/action-types";
import { COMICBOOKINFO_SERVICE_URI } from "../constants/endpoints";
@@ -54,7 +57,44 @@ export const comicinfoAPICall = (options) => async (dispatch) => {
}
};
export const applyComicVineMatch = options => async (dispatch) => {
console.log(options)
export const getComicBookDetailById =
(comicBookObjectId: string) => async (dispatch) => {
dispatch({
type: IMS_COMIC_BOOK_DB_OBJECT_CALL_IN_PROGRESS,
IMS_inProgress: true,
});
}
const result = await axios.request({
url: `http://localhost:3000/api/import/getComicBookById`,
method: "POST",
data: {
id: comicBookObjectId,
},
});
dispatch({
type: IMS_COMIC_BOOK_DB_OBJECT_FETCHED,
comicBookDetail: result.data,
IMS_inProgress: false,
});
};
export const applyComicVineMatch =
(match, comicObjectId) => async (dispatch) => {
dispatch({
type: IMS_COMIC_BOOK_DB_OBJECT_CALL_IN_PROGRESS,
IMS_inProgress: true,
});
const result = await axios.request({
url: "http://localhost:3000/api/import/applyComicVineMetadata",
method: "POST",
data: {
match,
comicObjectId,
},
});
dispatch({
type: IMS_COMIC_BOOK_DB_OBJECT_FETCHED,
comicBookDetail: result.data,
IMS_inProgress: false,
});
};

View File

@@ -163,7 +163,7 @@ export const fetchComicVineMatches = (searchPayload) => (dispatch) => {
console.log(error);
}
dispatch({
type: CV_CLEANUP,
});
// dispatch({
// type: CV_CLEANUP,
// });
};