Mutations second pass, add subscriptions + errors

This commit is contained in:
Christoph Kluge
2023-05-12 11:05:39 +02:00
parent 4bd1d30aa5
commit 23e485afce
3 changed files with 60 additions and 52 deletions

View File

@@ -8,9 +8,8 @@
export let metricsInScatterplots
const client = getContextClient();
$: updateConfigurationMutation = ({ name, value }) => {
mutationStore({
const updateConfigurationMutation = ({ name, value }) => {
return mutationStore({
client: client,
query: gql`mutation($name: String!, $value: String!) {
updateConfiguration(name: $name, value: $value)
@@ -26,6 +25,11 @@
updateConfigurationMutation({
name: data.name,
value: JSON.stringify(data.value)
}).subscribe(res => {
if (res.fetching === false && res.error) {
throw res.error
// console.log('Error on subscription: ' + res.error)
}
})
}
</script>