From 5248db446acda6f415561ced2470c00c0b1339d7 Mon Sep 17 00:00:00 2001 From: Lily Ballard Date: Fri, 9 Nov 2018 15:04:17 -0800 Subject: [PATCH] Serialize variables for POST properly Fixes #31. --- .../components/project-detail/project-detail.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/components/project-detail/project-detail.jsx b/src/app/components/project-detail/project-detail.jsx index 223b2c4..c923713 100644 --- a/src/app/components/project-detail/project-detail.jsx +++ b/src/app/components/project-detail/project-detail.jsx @@ -509,6 +509,17 @@ export default ({store, actionCreators, selectors, queries, factories, history, return } + let queryVariables = null + try { + const variablesStr = query.get('variables') + if (variablesStr != '') { + queryVariables = JSON.parse(variablesStr) + } + } catch (e) { + swal("Error", "The query variables are not valid JSON.", "error") + return + } + const startTime = moment() this.props.tabsUpdate({ @@ -535,7 +546,7 @@ export default ({store, actionCreators, selectors, queries, factories, history, params: { query: query.get('query'), operationName: query.get('operationName'), - variables: query.get('variables') + variables: queryVariables } })