about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch
diff options
context:
space:
mode:
authorHinaloe <hina@hinaloe.net>2019-03-26 19:13:20 +0900
committerThibaut Girka <thib@sitedethib.com>2019-03-26 16:12:46 +0100
commit872eab57847e21a349e02af3260a6d6b3f550ecb (patch)
treed54d4bee6e43fbb4a0677cf2cc8cbedfbac91b94 /app/javascript/flavours/glitch
parent89a0fa30531eec1d10757ac13225661596b2f91b (diff)
[Glitch] Do not set CSRF Token when no csrf header
Port 68f2211f00dfa3f823ad780ed748c1af0078a0cf to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch')
-rw-r--r--app/javascript/flavours/glitch/util/api.js8
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({