@@ -9,7 +9,7 @@ import { useMutation } from "@tanstack/react-query";
99import clsx from "clsx" ;
1010import { Effect } from "effect" ;
1111import { useRouter } from "next/navigation" ;
12- import { startTransition , useId , useState } from "react" ;
12+ import { type MouseEvent , startTransition , useId , useState } from "react" ;
1313import { toast } from "sonner" ;
1414import { useEffectMutation } from "@/lib/EffectRuntime" ;
1515import { withRpc } from "@/lib/Rpcs" ;
@@ -58,12 +58,12 @@ export function InviteTeamPage() {
5858 } ,
5959 } ) ;
6060
61- const handleSubmit = async ( e : React . MouseEvent < HTMLButtonElement > ) => {
61+ const handleSubmit = async ( e : MouseEvent < HTMLButtonElement > ) => {
6262 e . preventDefault ( ) ;
63- inviteTeamMutation . mutate ( ) ;
63+ await inviteTeamMutation . mutateAsync ( ) ;
6464 } ;
6565
66- const planCheckout = async ( e : React . MouseEvent < HTMLButtonElement > ) => {
66+ const planCheckout = async ( e : MouseEvent < HTMLButtonElement > ) => {
6767 e . preventDefault ( ) ;
6868 try {
6969 const planId = getProPlanId ( isAnnually ? "yearly" : "monthly" ) ;
@@ -94,13 +94,11 @@ export function InviteTeamPage() {
9494 } catch ( error ) {
9595 console . error ( "Plan checkout error:" , error ) ;
9696 toast . error ( "Something went wrong. Please try again." ) ;
97- } finally {
98- planCheckoutMutation . mutate ( e ) ;
9997 }
10098 } ;
10199
102100 const planCheckoutMutation = useMutation ( {
103- mutationFn : ( e : React . MouseEvent < HTMLButtonElement > ) => planCheckout ( e ) ,
101+ mutationFn : ( e : MouseEvent < HTMLButtonElement > ) => planCheckout ( e ) ,
104102 onError : ( error ) => {
105103 console . error ( "Plan checkout error:" , error ) ;
106104 toast . error ( "Something went wrong. Please try again." ) ;
0 commit comments