'Using response of URQL
Hello guys I am using urql for GraphQL. I have one mutation and its response is being displayed on "Network" tab of devtools, however I cannot get the result in the code.
here is my request code
choosePlan({
accountId: parseInt(id),
plan: plan
})
.then((res) => { console.log(res) })
.catch((err) => { console.log(err) })
either console.log(res) or console.log(err) is not displaying smth to console.
This choosePlan function is coming from custom hook called useChoosePlan
here its code
export type ChoosePlanVariables = Exact<{
accountId: Scalars['Int'];
plan: Scalars['String'];
}>
export type choosePlanMutation = {
__typename?: 'Mutation';
choosePlan: {
accountId: number;
plan: string;
}
}
export const ChoosePlanDocument = gql`
mutation choosePlan($accountId: Int!, $plan: String!){
choosePlan(accountId: $accountId, plan: $plan) {
redirectLink
}
}
`
export function useChoosePlan() {
return Urql.useMutation<choosePlanMutation, ChoosePlanVariables>(ChoosePlanDocument);
}
I am getting the result from graphql playground btw
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

