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

Port cc670c3234 to glitch-soc
lolsob-rspec
Hinaloe 2019-03-26 19:13:20 +09:00 committed by Thibaut Girka
parent 36daf28215
commit 824dc7c6b9
1 changed files with 6 additions and 2 deletions

View File

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