Skip to content

Commit

Permalink
use csrf token
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelljkotler committed Jul 31, 2024
1 parent abebee5 commit f0f1e68
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ function update() {
function tag() {
var id = document.getElementById("tag_id").value;
const url = `https://api.www.documentcloud.org/api/documents/${id}/data/test_key/`;
const token = ('; '+document.cookie).split(`; csrftoken=`).pop().split(';')[0];
fetch(url, {
method: "PUT",
credentials: "include",
headers: {
"X-CSRFToken": token,
"Content-Type": "application/json",
},
body: JSON.stringify({"values": ["test_value"]})
Expand Down

0 comments on commit f0f1e68

Please sign in to comment.