IMAGINATION IN PROGRESS

Skip to content

Update Endpoint Generation in `frontend/src/PhotoUploadForm.js`

Related to #19 (closed).

Like mentioned in this comment we'll need to update the Javascript to automatically append the district from the form so that data is routed appropriately to the backend.

That is, when Eastern District uploads photos associated with their district, the full URL should be:

http(s)://<sub-domain>.idaho4h.com/api/v1/upload-photos/district-competitions/eastern

Where the (s) denotes whether the connection is using encryption (like for the released application), and the <sub-domain> denotes the particular branch being used.

Notably, there is code already used in the source file that assigns the endpoint. We just need to tack onto that with the relevant district. Something like:

endpoint = "/api/v1/upload-photos/district-competitions/" + district_name.toLowerCase();

Note the use of the .toLowerCase() method at the end. That will ensure that the district name is always lowercase, which will make handling it on the backend more predictable.

There will be two parts to this that need to be tackled:

  1. Update the endpoint handling. @nachurch
  2. Format the form values appropriately for use. @engineerjoe440
Edited by Joe Stanley