red-lipped-batfish-scad / HugelMaps

MIT License
6 stars 2 forks source link

Frontend: PostCreator.jsx #13

Open cmlooff opened 2 years ago

cmlooff commented 2 years ago

Link: PostCreator.jsx

Communicate with the Server

Frontend Flowchart

graph TD;
PostContainer[PostContainer.jsx]-->PostCreator[PostCreator.jsx] ;
DavidZCheng commented 2 years ago

Discussing with Anthony, we want to separate Postcreator's function from rendering data received from the database. PostCreator now should only make HTTP Post to database and receive 200 code back from database on success. We will handle HTTP Get using a different component.

DavidZCheng commented 2 years ago

Was able to add an event handler for our submit button, able to pull the values out of the event object- working on making post to the backend now

DavidZCheng commented 2 years ago

9/18 Prop drilled the closePostCreator from Post Container down into PostCreator so that submit and cancel buttons will close the modal for PostCreator

DavidZCheng commented 2 years ago

9/19 Spent a significant amount of time troubleshooting why our post request body was coming into the backend as an empty object. Was able to resolve by removing the localhost:3000 pre-fix from the fetch request. Did not need Allow CORS.