Skip to content

Commit

Permalink
Serialize variables for POST properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Lily Ballard committed Nov 9, 2018
1 parent b2906f5 commit 5248db4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/components/project-detail/project-detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
}
})

Expand Down

0 comments on commit 5248db4

Please sign in to comment.