aaronspindler / RoomScout

A web app for finding and managing roommates
https://www.roomscout.ca
MIT License
32 stars 5 forks source link

Javascript Room Like POST #43

Closed aaronspindler closed 4 years ago

aaronspindler commented 4 years ago

I am trying to get the room like javascript functions to use POST instead of GET but I can't figure it out.

I am trying to convert it to this format

arcyleung commented 4 years ago

So you want to have just 1 endpoint, and pass the like/ unlike as a field in the POST body? I think room_create also uses POST so I'll reference that and see if it works

aaronspindler commented 4 years ago

I just want the javascript function to use post instead of get because it modify data and some browsers preload get requests

aaronspindler commented 4 years ago

I thought I could just change the function verb from get to post, but it just gives me a 500 error

arcyleung commented 4 years ago

It was missing the csrf token in the headers, I think Django mandates it in all POSTs

aaronspindler commented 4 years ago

That makes sense, I spent a good 30 min just constantly getting errors. I will merge it when I’m on my computer. Have a great Christmas!