From 1e9c291d39173b06aa1f5b6fcc534a693bbc1ab9 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 9 Jul 2024 09:32:03 +0800 Subject: [PATCH] Fix string interp on update label mutation We should always use input instead of strings like this. --- .../networking/mutations/updateLabelMutation.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/web/lib/networking/mutations/updateLabelMutation.ts b/packages/web/lib/networking/mutations/updateLabelMutation.ts index 07e6cdbc8..6e4ab6b59 100644 --- a/packages/web/lib/networking/mutations/updateLabelMutation.ts +++ b/packages/web/lib/networking/mutations/updateLabelMutation.ts @@ -12,15 +12,8 @@ export async function updateLabelMutation( input: UpdateLabelInput ): Promise { const mutation = gql` - mutation { - updateLabel( - input: { - color: "${input.color}" - name: "${input.name}" - description: "${input.description}" - labelId: "${input.labelId}" - } - ) { + mutation UpdateLabel($input: UpdateLabelInput!) { + updateLabel(input: $input) { ... on UpdateLabelSuccess { label { id @@ -38,7 +31,9 @@ export async function updateLabelMutation( ` try { - const data = await gqlFetcher(mutation) + const data = await gqlFetcher(mutation, { + input, + }) const output = data as any return output?.updatedLabel } catch (err) {