DigitalLiteracyProject / class-3.0

0 stars 0 forks source link

Passing Template Variables into Requests #5

Open nathanael-cho opened 7 years ago

nathanael-cho commented 7 years ago

I just pushed an implementation of the draw page that looks ugly but works as intended (what I pushed shortly after posting this). However, the method of passing the template variable along that I used is extremely hacky, putting classroom_id from the draw url into a hidden div from which we can extract its value when working in React.

The solution would most likely be to make the GET request directly from the server, but I'm not sure how to do that as of now (and it's 5 in the morning). Help is appreciated :). Thanks y'all for putting up with me.

icasdri commented 7 years ago

We will probably need to add this to the README as it is confusing.

There's a distinction between client-side paths and server-side paths. For instance, the URL http://dlp.io/server/thing/2/#/client/thing/7 has server-side path /server/thing/2 and client-side path (everything after the hashtag, formally called anchor tags) /client/thing/7.

In our construction, server-side paths are handled in the app's urls.py whereas client-side paths will be handled by React Router. We use server-side paths for the root /app endpoint (that serves up the app's HTML, CSS, and React javascript) and any /app/api/... endpoints. Everything else should be client-side.

In the case of draw. We should be accepting the classroom id from the end user as a client-side and not server-side path. This means the logic should reside with React Router and not in urls.py.

Hope this helps.