refactor(http-client): set xsrf token on post requests
This commit is contained in:
parent
a0d067fabf
commit
6d0eb93a8d
@ -1,3 +1,5 @@
|
|||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
export class HttpClient {
|
export class HttpClient {
|
||||||
|
|
||||||
static ACCEPT = {
|
static ACCEPT = {
|
||||||
@ -20,6 +22,8 @@ export class HttpClient {
|
|||||||
|
|
||||||
post(args) {
|
post(args) {
|
||||||
args.method = 'POST';
|
args.method = 'POST';
|
||||||
|
args.headers = args.headers || {};
|
||||||
|
args.headers['X-XSRF-TOKEN'] = Cookies.get('XSRF-TOKEN');
|
||||||
return this._fetch(args);
|
return this._fetch(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user