Provide local backend testing compatibility (with gitpod)

master
sigonasr2, Sig, Sigo 3 years ago
parent 07690dab7f
commit 16dc75ded8
  1. 14
      BACKEND_SETUP_INFO
  2. 1
      package.json
  3. 6
      src/App.js

@ -0,0 +1,14 @@
The backend can be run for local testing by loading a
new docker-compose workspace provided by the projectdivar
git repository.
once loaded, you can seed the database using the seed files
from the ngsplanner_backend repository. You can use the locally
created .docker_terminal command to access the terminal of the
projectdivar_postgres_1 instance. Finally, you need to
add a .env file for your environment that includes:
REACT_APP_BACKEND_URL=https://4501-scarlet-echidna-bpwfvar6.ws-us11.gitpod.io/ngsplanner
Replacing the URL with the URL that points to the /server docker
hosted backend.

@ -9,6 +9,7 @@
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.1",
"express": "^4.17.1",
"gh-pages": "^3.2.3",
"react": "^17.0.2",
"react-bootstrap-icons": "^1.5.0",

@ -430,6 +430,7 @@ function TableEditor(p) {
const [data,setData] = useState([])
const [update,setUpdate] = useState(false)
const [submitVals,setSubmitVal] = useReducer(updateVals,initialVals)
const [report,setReport] = useState("")
function SubmitBoxes() {
axios.post(BACKEND_URL+p.path,submitVals)
@ -455,6 +456,9 @@ function TableEditor(p) {
setFields(cols.filter((col)=>col.name!=="id").map((col)=>col.name))
setData(rows)
})
.catch((err)=>{
setReport(JSON.stringify(err))
})
setUpdate(false)
}
},[update,p.path])
@ -462,7 +466,7 @@ function TableEditor(p) {
return <>
<div className="table-responsive">
<table cellPadding="10" className="table text-light table-padding">
<caption>List of users</caption>
<caption>{JSON.stringify(report)}</caption>
<thead>
<tr>
<th className="table-padding"></th>

Loading…
Cancel
Save