refactor(http-client): set xsrf token on post requests

This commit is contained in:
Sarah Vaupel 2020-01-28 18:10:29 +01:00 committed by Gregor Kleen
parent a0d067fabf
commit 6d0eb93a8d

View File

@ -1,3 +1,5 @@
import Cookies from 'js-cookie';
export class HttpClient {
static ACCEPT = {
@ -20,6 +22,8 @@ export class HttpClient {
post(args) {
args.method = 'POST';
args.headers = args.headers || {};
args.headers['X-XSRF-TOKEN'] = Cookies.get('XSRF-TOKEN');
return this._fetch(args);
}