diff --git a/src/App.js b/src/App.js index be271eb..5066ca6 100644 --- a/src/App.js +++ b/src/App.js @@ -405,10 +405,10 @@ function InputBox(p) { } } - return p.data?{keydownFunc(f)}} onChange={(f)=>{changeFunc(f)}} onBlur={(f)=>{blurFunc(f)}}> {p.includeBlankValue&&)} - :{keydownFunc(f)}} onChange={(f)=>{changeFunc(f)}} onBlur={(f)=>{blurFunc(f)}}/> + :{keydownFunc(f)}} onChange={(f)=>{changeFunc(f)}} onBlur={(f)=>{blurFunc(f)}}/> } function TableEditor(p) { @@ -431,16 +431,23 @@ function TableEditor(p) { const [dependencies,setDependencies] = useState([]) const [importAllowed,setImportAllowed] = useState(false) const [fileData,setFileData] = useState(undefined) + const [lockSubmission,setLockSubmission] = useState(false) function SubmitBoxes() { - axios.post(BACKEND_URL+p.path,submitVals) - .then(()=>{ - setSubmitVal("Clear") - setUpdate(true) - }) - .catch((err)=>{ - alert(JSON.stringify(err.response.data)) - }) + if (!lockSubmission) { + setLockSubmission(true) + axios.post(BACKEND_URL+p.path,submitVals) + .then(()=>{ + setSubmitVal("Clear") + setUpdate(true) + }) + .catch((err)=>{ + alert(JSON.stringify(err.response.data)) + }) + .then(()=>{ + setLockSubmission(false) + }) + } } useGlobalKeyDown(()=>{ @@ -523,7 +530,7 @@ function TableEditor(p) { (f)=>{setSubmitVal({field:col.name,value:f});}}/>})}{SubmitBoxes()}} className="submitbutton"/>} {data.map((dat)=> {axios.delete(BACKEND_URL+p.path,{data:{id:dat.id}}).then(()=>{setUpdate(true)}).catch((err)=>{alert(err.response.data)})}}/>{fields.map((col,i)=> - { + { return axios.patch(BACKEND_URL+p.path,{ [col.name]:value, id:dat.id