+
{/* comicVine metadata presence */}
{isComicBookMetadataAvailable && (
-
-
-
+

)}
{!isEmpty(locg) && (
-
-
-
+

)}
{/* Issue type */}
{isComicBookMetadataAvailable &&
!isNil(
detectIssueTypes(comicvine.volumeInformation.description),
) ? (
-
+
{
detectIssueTypes(
comicvine.volumeInformation.description,
@@ -108,7 +98,7 @@ export const WantedComicsList = ({
);
},
)}
-
+
>
);
};
diff --git a/src/client/components/Search/Search.tsx b/src/client/components/Search/Search.tsx
index d474bbf..90d1e49 100644
--- a/src/client/components/Search/Search.tsx
+++ b/src/client/components/Search/Search.tsx
@@ -10,7 +10,10 @@ import ellipsize from "ellipsize";
import { convert } from "html-to-text";
import dayjs from "dayjs";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { COMICVINE_SERVICE_URI } from "../../constants/endpoints";
+import {
+ COMICVINE_SERVICE_URI,
+ LIBRARY_SERVICE_BASE_URI,
+} from "../../constants/endpoints";
import axios from "axios";
interface ISearchProps {}
@@ -21,6 +24,7 @@ export const Search = ({}: ISearchProps): ReactElement => {
};
const queryClient = useQueryClient();
const [searchQuery, setSearchQuery] = useState("");
+ const [comicVineMetadata, setComicVineMetadata] = useState({});
const getCVSearchResults = (searchQuery) => {
console.log(searchQuery);
setSearchQuery(searchQuery.search);
@@ -50,16 +54,40 @@ export const Search = ({}: ISearchProps): ReactElement => {
queryKey: ["comicvineSearchResults", searchQuery],
enabled: !isNil(searchQuery),
});
- console.log(comicVineSearchResults);
- const addToLibrary = useCallback(
- (sourceName: string, comicData) =>
- importToDB(sourceName, { comicvine: comicData }),
- [],
- );
- // const comicVineSearchResults = useSelector(
- // (state: RootState) => state.comicInfo.searchResults,
- // );
+ // add to library
+ const { data: additionResult } = useQuery({
+ queryFn: async () =>
+ await axios({
+ url: `${LIBRARY_SERVICE_BASE_URI}/rawImportToDb`,
+ method: "POST",
+ data: {
+ importType: "new",
+ payload: {
+ rawFileDetails: {
+ name: "",
+ },
+ importStatus: {
+ isImported: true,
+ tagged: false,
+ matchedResult: {
+ score: "0",
+ },
+ },
+ sourcedMetadata:
+ { comicvine: comicVineMetadata?.comicData } || null,
+ acquisition: { source: { wanted: true, name: "comicvine" } },
+ },
+ },
+ }),
+ queryKey: ["additionResult"],
+ enabled: !isNil(comicVineMetadata.comicData),
+ });
+
+ console.log(comicVineMetadata);
+ const addToLibrary = (sourceName: string, comicData) =>
+ setComicVineMetadata({ sourceName, comicData });
+
const createDescriptionMarkup = (html) => {
return { __html: html };
};
@@ -67,8 +95,8 @@ export const Search = ({}: ISearchProps): ReactElement => {
return (
<>