Merge pull request #4172 from omnivore-app/fix/web-mutation-string-interop
Use GQL variables for all mutations
This commit is contained in:
@ -14,7 +14,7 @@ export async function addPopularReadMutation(
|
||||
readName: string
|
||||
): Promise<string | undefined> {
|
||||
const mutation = gql`
|
||||
mutation {
|
||||
mutation AddPopularRead($name: String!) {
|
||||
addPopularRead(name: "${readName}") {
|
||||
... on AddPopularReadSuccess {
|
||||
pageId
|
||||
|
||||
@ -15,8 +15,8 @@ export async function deleteLabelMutation(
|
||||
labelId: string
|
||||
): Promise<any | undefined> {
|
||||
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)
|
||||
|
||||
@ -15,8 +15,8 @@ export async function deleteWebhookMutation(
|
||||
id: string
|
||||
): Promise<any | undefined> {
|
||||
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)
|
||||
|
||||
@ -15,8 +15,8 @@ export async function revokeApiKeyMutation(
|
||||
id: string
|
||||
): Promise<any | undefined> {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user