mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix subscribe and unsubscribe mutation query in web
This commit is contained in:
parent
b4347fc9b7
commit
0289efb0b6
2 changed files with 6 additions and 4 deletions
|
|
@ -7,11 +7,11 @@ import {
|
|||
|
||||
type SubscribeResult = {
|
||||
subscribe: Subscribe
|
||||
errorCodes?: unknown[]
|
||||
}
|
||||
|
||||
type Subscribe = {
|
||||
subscriptions: Subscription[]
|
||||
errorCodes?: unknown[]
|
||||
}
|
||||
|
||||
export type SubscribeMutationInput = {
|
||||
|
|
@ -39,7 +39,7 @@ export async function subscribeMutation(
|
|||
`
|
||||
try {
|
||||
const data = (await gqlFetcher(mutation, { input })) as SubscribeResult
|
||||
return data.errorCodes ? undefined : data.subscribe
|
||||
return data.subscribe.errorCodes ? undefined : data.subscribe
|
||||
} catch (error) {
|
||||
console.log('subscribeMutation error', error)
|
||||
return undefined
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import { Subscription } from '../queries/useGetSubscriptionsQuery'
|
|||
|
||||
type UnsubscribeResult = {
|
||||
unsubscribe: Unsubscribe
|
||||
errorCodes?: unknown[]
|
||||
}
|
||||
|
||||
type Unsubscribe = {
|
||||
subscription: Subscription
|
||||
errorCodes?: unknown[]
|
||||
}
|
||||
|
||||
export async function unsubscribeMutation(
|
||||
|
|
@ -32,7 +32,9 @@ export async function unsubscribeMutation(
|
|||
|
||||
try {
|
||||
const data = (await gqlFetcher(mutation)) as UnsubscribeResult
|
||||
return data.errorCodes ? undefined : data.unsubscribe.subscription.id
|
||||
return data.unsubscribe.errorCodes
|
||||
? undefined
|
||||
: data.unsubscribe.subscription.id
|
||||
} catch (error) {
|
||||
console.log('unsubscribeMutation error', error)
|
||||
return undefined
|
||||
|
|
|
|||
Loading…
Reference in a new issue