diff options
author | ThibG <thib@sitedethib.com> | 2019-03-26 19:51:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-26 19:51:28 +0100 |
commit | bdf4f56f9a9052668e7cce1ce7863268e03d9c86 (patch) | |
tree | 9952f2e08780455dc1af0febe4b374f5b8a60e2e /app/javascript/flavours/glitch/util | |
parent | 9f56511860493b770c2e535be0f8ce4777c8d373 (diff) | |
parent | 9e80b34a95c39d0a1a944713f0f4d6cc5e8b8c43 (diff) |
Merge pull request #966 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/util')
-rw-r--r-- | app/javascript/flavours/glitch/util/api.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/util/api.js b/app/javascript/flavours/glitch/util/api.js index 033d2d67b..c59a24518 100644 --- a/app/javascript/flavours/glitch/util/api.js +++ b/app/javascript/flavours/glitch/util/api.js @@ -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({ |