Skip to content

Commit

Permalink
Add CSRF_TOKEN to POST save_view
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Jun 17, 2023
1 parent 9c83bef commit ff30874
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/modules/static_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,24 @@ async function executeProjectAction(action, args) {
method: action,
args: args
}
const resp = await fetch("/meths/execute_project_action/",

console.log("window.CSRF_TOKEN", window["CSRF_TOKEN"]);

const request = new Request(
"meths/execute_project_action/",
{
method: "POST",
body: JSON.stringify(data),
method: 'POST',
headers: {
'X-CSRFToken': window["CSRF_TOKEN"],
"Accept": "application/json,text/plain,*/*",
"Content-Type": "application/json"
}
});
},
mode: 'same-origin',
body: JSON.stringify(data),
}
);

const resp = await fetch(request);
let rspData = {success: false};
try {
rspData = await resp.json();
Expand Down

0 comments on commit ff30874

Please sign in to comment.