diff --git a/src/components/CurveFit.js b/src/components/CurveFit.js index 0395374..9b335a5 100644 --- a/src/components/CurveFit.js +++ b/src/components/CurveFit.js @@ -8,11 +8,12 @@ import ImageDownloader from './ImageDownloader'; function CurveFit({ show }) { const [showCardInfo, setShowCardInfo] = useState(false); const [svgData, setSvgData] = useState(null); + const [loading, setLoading] = useState(true); const fetchSvg = () => { axios({ method: 'get', - url: "https://asia-south1-hpos-qa.cloudfunctions.net/curvefit", + url: "https://asia-south1-hpos-af3cc.cloudfunctions.net/crdboxplot", data: { "_id": "id", "underMedication": false, @@ -28,29 +29,37 @@ function CurveFit({ show }) { }) .then(response => response.data) .then((data) => { - // setMessage(`${id} is being created`); - // setSvgData(data?.plot?.replace('\"', '').replace('\n', '').replace('"', "'")); + setSvgData(data?.plot?.replace('\"', '').replace('\n', '').replace('"', "'")); + setLoading(false); // Set loading to false once data is fetched }) .catch((err) => { console.log(err); - // setMessage(`error: ${err?.message}`); + setLoading(false); // Set loading to false in case of an error }); } useEffect(() => { if (!svgData) { - // fetchSvg(); + fetchSvg(); } }, []); return (
Loading...
+