Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
No need for csrftoken in headers, closes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Mar 20, 2024
1 parent 02139a3 commit 9f2a445
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions datasette_paste/templates/paste_create_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ <h1>Paste data to create a table</h1>

<form id="pasteForm" style="display: none">
<p>
<input type="hidden" name="csrftoken" value="{{ csrftoken() }}">
<label for="id_table_name">Table name:</label>
<input type="text" required name="table" id="id_table_name" value="" placeholder="Enter a new table name">
</p>
Expand Down Expand Up @@ -267,10 +266,8 @@ <h1>Paste data to create a table</h1>
progressBar.max = currentRows.length;
// Submit to API in batches of 100
const url = window.location.pathname.replace('/-/paste', '/-/create');
const csrftoken = document.querySelector('input[name="csrftoken"]').value;
const headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('X-CSRFToken', csrftoken);
const batchSize = 100;
for (let i = 0; i < currentRows.length; i += batchSize) {
const batch = currentRows.slice(i, i + batchSize);
Expand Down

0 comments on commit 9f2a445

Please sign in to comment.