[Glitch] Do not set CSRF Token when no csrf header

Port 68f2211f00 to glitch-soc
main
Hinaloe 2019-03-26 19:13:20 +09:00 committed by Thibaut Girka
parent 89a0fa3053
commit 872eab5784
1 changed files with 6 additions and 2 deletions

View File

@ -13,10 +13,14 @@ export const getLinks = response => {
};
let csrfHeader = {};
function setCSRFHeader() {
const csrfToken = document.querySelector('meta[name=csrf-token]').content;
csrfHeader['X-CSRF-Token'] = csrfToken;
const csrfToken = document.querySelector('meta[name=csrf-token]');
if (csrfToken) {
csrfHeader['X-CSRF-Token'] = csrfToken.content;
}
}
ready(setCSRFHeader);
export default getState => axios.create({