From f92cb02b9bc4b6b09c48dee72ac3a9f0de213dc3 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Sun, 11 Dec 2016 23:18:41 +0100
Subject: Fix #203 - try/catch around JSON parse

---
 app/assets/javascripts/components/api.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'app/assets/javascripts/components/api.jsx')

diff --git a/app/assets/javascripts/components/api.jsx b/app/assets/javascripts/components/api.jsx
index 080c2bd6a..93cfc8046 100644
--- a/app/assets/javascripts/components/api.jsx
+++ b/app/assets/javascripts/components/api.jsx
@@ -17,6 +17,10 @@ export default getState => axios.create({
   },
 
   transformResponse: [function (data) {
-    return JSON.parse(data);
+    try {
+      return JSON.parse(data);
+    } catch(Exception) {
+      return data;
+    }
   }]
 });
-- 
cgit 

