diff --git a/packages/web/lib/networking/mutations/addPopularReadMutation.ts b/packages/web/lib/networking/mutations/addPopularReadMutation.ts index c8914e7b5..e5d719077 100644 --- a/packages/web/lib/networking/mutations/addPopularReadMutation.ts +++ b/packages/web/lib/networking/mutations/addPopularReadMutation.ts @@ -14,7 +14,7 @@ export async function addPopularReadMutation( readName: string ): Promise { const mutation = gql` - mutation { + mutation AddPopularRead($name: String!) { addPopularRead(name: "${readName}") { ... on AddPopularReadSuccess { pageId diff --git a/packages/web/lib/networking/mutations/deleteLabelMutation.ts b/packages/web/lib/networking/mutations/deleteLabelMutation.ts index 988bac3f5..c8b7936a0 100644 --- a/packages/web/lib/networking/mutations/deleteLabelMutation.ts +++ b/packages/web/lib/networking/mutations/deleteLabelMutation.ts @@ -15,8 +15,8 @@ export async function deleteLabelMutation( labelId: string ): Promise { const mutation = gql` - mutation { - deleteLabel(id: "${labelId}") { + mutation DeleteLabel($id: ID!) { + deleteLabel(id: $id) { ... on DeleteLabelSuccess { label { id @@ -34,7 +34,9 @@ export async function deleteLabelMutation( ` try { - const data = await gqlFetcher(mutation) as DeleteLabelResult + const data = (await gqlFetcher(mutation, { + id: labelId, + })) as DeleteLabelResult return data.errorCodes ? undefined : data.deleteLabel.label.id } catch (error) { console.log('deleteLabelMutation error', error) diff --git a/packages/web/lib/networking/mutations/deleteWebhookMutation.ts b/packages/web/lib/networking/mutations/deleteWebhookMutation.ts index 0533c6b77..cc2d572b5 100644 --- a/packages/web/lib/networking/mutations/deleteWebhookMutation.ts +++ b/packages/web/lib/networking/mutations/deleteWebhookMutation.ts @@ -15,8 +15,8 @@ export async function deleteWebhookMutation( id: string ): Promise { const mutation = gql` - mutation { - deleteWebhook(id: "${id}") { + mutation DeleteWebhook($id: ID!) { + deleteWebhook(id: $id) { ... on DeleteWebhookSuccess { webhook { id @@ -30,7 +30,7 @@ export async function deleteWebhookMutation( ` try { - const data = (await gqlFetcher(mutation)) as DeleteWebhookResult + const data = (await gqlFetcher(mutation, { id })) as DeleteWebhookResult return data.errorCodes ? undefined : data.deleteWebhook.webhook.id } catch (error) { console.log('deleteWebhookMutation error', error) diff --git a/packages/web/lib/networking/mutations/revokeApiKeyMutation.ts b/packages/web/lib/networking/mutations/revokeApiKeyMutation.ts index 83f9447f5..09bf7d971 100644 --- a/packages/web/lib/networking/mutations/revokeApiKeyMutation.ts +++ b/packages/web/lib/networking/mutations/revokeApiKeyMutation.ts @@ -15,8 +15,8 @@ export async function revokeApiKeyMutation( id: string ): Promise { const mutation = gql` - mutation { - revokeApiKey(id: "${id}") { + mutation RevokeApiKey($id: ID!) { + revokeApiKey(id: $id) { ... on RevokeApiKeySuccess { apiKey { id @@ -30,7 +30,7 @@ export async function revokeApiKeyMutation( ` try { - const data = (await gqlFetcher(mutation)) as RevokeApiKeyResult + const data = (await gqlFetcher(mutation, { id })) as RevokeApiKeyResult return data.errorCodes ? undefined : data.revokeApiKey.apiKey.id } catch (error) { console.log('revokeApiKeyMutation error', error)