From 2226f5cc03c77597f53f96db57e492c936e7458f Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Tue, 10 Aug 2021 15:11:52 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9B=20Building=20out=20the=20search=20?= =?UTF-8?q?page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/actions/fileops.actions.tsx | 2 +- src/client/components/Search.tsx | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/client/actions/fileops.actions.tsx b/src/client/actions/fileops.actions.tsx index 746505e..69a2189 100644 --- a/src/client/actions/fileops.actions.tsx +++ b/src/client/actions/fileops.actions.tsx @@ -124,7 +124,7 @@ export const fetchComicVineMatches = (searchPayload) => (dispatch) => { axios .request({ - url: "http://localhost:3080/api/comicvine/fetchseries", + url: "http://localhost:3080/api/comicvine/fetchresource", method: "POST", data: { format: "json", diff --git a/src/client/components/Search.tsx b/src/client/components/Search.tsx index ad7cb5b..79f1461 100644 --- a/src/client/components/Search.tsx +++ b/src/client/components/Search.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, ReactElement } from "react"; +import React, { useMemo, useCallback, ReactElement } from "react"; import { removeLeadingPeriod, escapePoundSymbol, @@ -7,11 +7,28 @@ import { useTable } from "react-table"; import prettyBytes from "pretty-bytes"; import ellipsize from "ellipsize"; -import { useSelector } from "react-redux"; +import { useSelector, useDispatch } from "react-redux"; +import { comicinfoAPICall } from "../actions/comicinfo.actions"; interface ISearchProps {} export const Search = ({}: ISearchProps): ReactElement => { + const dispatch = useDispatch(); + const getCVSearchResults = useCallback(() => { + dispatch( + comicinfoAPICall({ + callURIAction: "search", + method: "GET", + params: { + api_key: "a5fa0663683df8145a85d694b5da4b87e1c92c69", + format: "json", + limit: "10", + offset: "0", + field_list: "id,name,deck,api_detail_url", + }, + }), + ); + }, [dispatch]); return ( <>