mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-04 18:36:13 +02:00
Set CSRF token
Can we set CSRF token automatically using rails-ujs npm? Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
parent
c632380e1d
commit
7e1ec95198
@ -146,11 +146,17 @@ window.addEventListener('load', () => {
|
||||
if(this.previewAjax) {
|
||||
this.previewAjax.abort();
|
||||
}
|
||||
|
||||
const token = document.getElementsByName("csrf-token")[0].getAttribute('content')
|
||||
|
||||
var self = this;
|
||||
new Promise(function(resolve, reject) {
|
||||
self.previewAjax = $.ajax({
|
||||
method: "POST",
|
||||
url: "/api/regexp_preview",
|
||||
headers: {
|
||||
'X-CSRF-Token': token
|
||||
},
|
||||
data: {
|
||||
regexp: self.params.setting.regexp,
|
||||
time_format: self.params.setting.time_format,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user