mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 09:33:54 +01:00
Use CSRF_HEADER_NAME from global config for preview panel DELETE request
This commit is contained in:
parent
a4ec6afae5
commit
ff8a33733c
@ -1,3 +1,4 @@
|
||||
import { WAGTAIL_CONFIG } from '../../config/wagtailConfig';
|
||||
import { gettext } from '../../utils/gettext';
|
||||
|
||||
function initPreview() {
|
||||
@ -143,16 +144,11 @@ function initPreview() {
|
||||
newIframe.addEventListener('load', handleLoad);
|
||||
};
|
||||
|
||||
const clearPreviewData = () => {
|
||||
const csrfToken = document.querySelector(
|
||||
'input[name="csrfmiddlewaretoken"]',
|
||||
).value;
|
||||
|
||||
return fetch(previewUrl, {
|
||||
headers: { 'X-CSRFToken': csrfToken },
|
||||
const clearPreviewData = () =>
|
||||
fetch(previewUrl, {
|
||||
headers: { [WAGTAIL_CONFIG.CSRF_HEADER_NAME]: WAGTAIL_CONFIG.CSRF_TOKEN },
|
||||
method: 'DELETE',
|
||||
});
|
||||
};
|
||||
|
||||
const setPreviewData = () => {
|
||||
// Bail out if there is already a pending update
|
||||
|
Loading…
Reference in New Issue
Block a user