fixed csrf token didn't work in admin panel

This commit is contained in:
Tony Yang 2019-06-01 01:12:36 +08:00
parent 9b402ef0ac
commit 61eba79770
Signed by: t510599
GPG Key ID: D88388851C28715D

View File

@ -3,7 +3,7 @@ axios.defaults.withCredentials = true;
axios.interceptors.request.use(function (config) {
var crypto = window.crypto || window.msCrypto;
let csrfToken = btoa(String(crypto.getRandomValues(new Uint32Array(1))[0]));
document.cookie = `${axios.defaults.xsrfCookieName}=${csrfToken}`;
document.cookie = `${axios.defaults.xsrfCookieName}=${csrfToken}; max-age=10; path=/`;
return config;
}, function (error) {
return Promise.reject(error);