From 38d10c6f99544f0ec1ead3110160368b3bec802e Mon Sep 17 00:00:00 2001 From: Rohan Date: Fri, 29 Nov 2024 18:40:08 +0530 Subject: [PATCH] fix: refetch orgs when cancelling subscription --- .../components/settings/organisation/StripeBillingInfo.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/components/settings/organisation/StripeBillingInfo.tsx b/frontend/components/settings/organisation/StripeBillingInfo.tsx index 771946b93..c524f696e 100644 --- a/frontend/components/settings/organisation/StripeBillingInfo.tsx +++ b/frontend/components/settings/organisation/StripeBillingInfo.tsx @@ -7,6 +7,7 @@ import { GetSubscriptionDetails } from '@/graphql/queries/billing/getSubscriptio import { DeleteStripePaymentMethod } from '@/graphql/mutations/billing/deletePaymentMethod.gql' import { CancelStripeSubscription } from '@/graphql/mutations/billing/cancelProSubscription.gql' import { SetDefaultStripePaymentMethodOp } from '@/graphql/mutations/billing/setDefaultPaymentMethod.gql' +import { GetOrganisations } from '@/graphql/queries/getOrganisations.gql' import { relativeTimeFromDates } from '@/utils/time' import { useLazyQuery, useMutation, useQuery } from '@apollo/client' import { useContext, useRef } from 'react' @@ -257,11 +258,13 @@ const CancelSubscriptionDialog = ({ subscriptionId }: { subscriptionId: string } const dialogRef = useRef<{ closeModal: () => void }>(null) const [cancelSubscription] = useMutation(CancelStripeSubscription) + const handleCancelSubscription = async () => await cancelSubscription({ variables: { subscriptionId, organisationId: activeOrganisation!.id }, refetchQueries: [ { query: GetSubscriptionDetails, variables: { organisationId: activeOrganisation?.id } }, + { query: GetOrganisations }, ], }).then(() => { toast.success('Cancelled subscription')