diff --git a/client/src/App.tsx b/client/src/App.tsx index eb4f134..fce7732 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -10,6 +10,26 @@ function App() { const [isLoading, setIsLoading] = useState(false); const [ready, setReady] = useState(false); + + const forceScrap = async () => { + setIsLoading(true); + const url = `${process.env.REACT_APP_API_URL}/api/force-scrap`; + try { + const res = await axios.post(url); + + const { ready } = res.data; + setReady(ready); + + setIsLoading(false); + alert('All is Ready Now'); + + } catch (error) { + alert('An error occurred. \n' + error); + setIsLoading(false); + } + + } + const onSubmit = async (data: any) => { setIsLoading(true); @@ -44,15 +64,16 @@ function App() { } }; + return (
- {results === undefined ? ( - - ) : ( - - )} + { + (results === undefined ? + + : ) + }
diff --git a/client/src/InputForm.jsx b/client/src/InputForm.jsx index 49f7b0c..77d1a24 100644 --- a/client/src/InputForm.jsx +++ b/client/src/InputForm.jsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; -function InputForm({ onSubmit, isLoading }) { +function InputForm({ onSubmit, isLoading ,forceScrap}) { const [numOfPolygonPages, setNumOfPolygonPages] = useState(''); const [problemsId, setProblemsId] = useState(''); @@ -18,38 +18,51 @@ function InputForm({ onSubmit, isLoading }) { setter(event.target.value); }; + + return ( -
-
- -
- -
-