Commit 24817c65 authored by Filipa Lacerda's avatar Filipa Lacerda

Add crsf token in axios calls

parent 506a4e75
/* globals Flash */ /* globals Flash */
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import axios from 'axios'; import axios from 'axios';
import setAxiosCsrfToken from './lib/utils/axios_utils';
import Poll from './lib/utils/poll'; import Poll from './lib/utils/poll';
import { s__ } from './locale'; import { s__ } from './locale';
import initSettingsPanels from './settings_panels'; import initSettingsPanels from './settings_panels';
...@@ -17,6 +18,7 @@ import Flash from './flash'; ...@@ -17,6 +18,7 @@ import Flash from './flash';
class ClusterService { class ClusterService {
constructor(options = {}) { constructor(options = {}) {
this.options = options; this.options = options;
setAxiosCsrfToken();
} }
fetchData() { fetchData() {
return axios.get(this.options.endpoint); return axios.get(this.options.endpoint);
......
import axios from 'axios';
import csrf from './csrf';
export default function setAxiosCsrfToken() {
axios.defaults.headers.common[csrf.headerKey] = csrf.token;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment