1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Do not set CSRF Token when no csrf header (#10383)

This commit is contained in:
Hinaloe 2019-03-26 19:13:20 +09:00 committed by Eugen Rochko
parent 792a0f106e
commit 68f2211f00

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({