Adding a request header on beforeSend
Question
Im using storageManager remote but the site has csrf token
beforeSend: function (t) {
var token = $('meta[name="csrf_token"]').attr('content');
if (token) {
return t.setRequestHeader('X-CSRF-TOKEN', token);
}
},
Gives an error "Uncaught TypeError: Cannot read property 'setRequestHeader' of undefined"
obviously because t is undefined, how can I pass the headers into beforeSend without changing grapesjsAnswers (2)
Instead of beforeSend, use the headers like this
headers:{'X-CSRF-TOKEN':'foo'},
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1431
Load HTML file from remote
I hosted my html content in cloud. Then trying to load the html content in the editor I found the error: "Response to preflight request doe...
Issue #1003
[Question/ bug]"Uncaught TypeError: t.get is not a function" on adding select-comp
on adding button "select" component { id : 'select', className : 'fa fa-mouse-pointer', command : 'select-comp', }, in button's panels gett...
Issue #1614
[Bug]: adding css variables as style manager property
trying to add css variable to style manager causing error: Uncaught TypeError: Cannot read property 'toUpperCase' of undefined fiddle Am i...
Issue #439
unstable
In my machine grapesjs is unstable. Generally at first request throws below error. After refreshing one or two times, it works. Bug exists...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.