user authentication
This commit is contained in:
@@ -169,7 +169,9 @@
|
||||
}
|
||||
const formData = new FormData();
|
||||
formData.append('content', cm ? cm.getValue() : contentEl.value);
|
||||
fetch('/edit_text/' + filePath, { method: 'POST', body: formData })
|
||||
const m = document.cookie.match(/(?:^|; )csrf_token=([^;]+)/);
|
||||
const csrf = m && m[1] ? decodeURIComponent(m[1]) : '';
|
||||
fetch('/editor/edit_text/' + filePath, { method: 'POST', headers: csrf ? { 'X-CSRF-Token': csrf } : {}, body: formData })
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
|
||||
Reference in New Issue
Block a user