From 628aca5616af71c765819cc94f8be17ac02c386d Mon Sep 17 00:00:00 2001 From: Jin Choi Date: Mon, 26 Jun 2023 14:41:36 +0200 Subject: [PATCH] feat: use post request response --- .../cvAnonymisation/CvAnonymisationPage.tsx | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/pages/cvAnonymisation/CvAnonymisationPage.tsx b/src/pages/cvAnonymisation/CvAnonymisationPage.tsx index 2281d83..b0c7c06 100644 --- a/src/pages/cvAnonymisation/CvAnonymisationPage.tsx +++ b/src/pages/cvAnonymisation/CvAnonymisationPage.tsx @@ -19,22 +19,6 @@ const CvAnonymisationPage = () => { const [selectedFile, setSelectedFile] = useState(""); const fileInputRef = useRef(null); - const fetchData = async () => { - try { - //Used direct url for now. To be refactored with proxy server - const response = await fetch( - "http://localhost:5500/cv_anonymisation/CVs/downloads/anonymized_cv.txt", - { - method: "GET", - } - ); - const parsedText = await response.text(); - setAnonymisedData(parsedText); - } catch (error) { - console.error("Error reading the file:", error); - } - }; - const handleButtonClick = (e: any) => { e.preventDefault(); fileInputRef.current?.click(); @@ -60,13 +44,13 @@ const CvAnonymisationPage = () => { if (response.ok) { console.log(response); + setAnonymisedData(response.body as unknown as string); } else { console.error("Anonymisation Failed", response.status); } } catch (error) { console.error(error); } - fetchData(); } }; return (