diff options
Diffstat (limited to 'lib/vendors/table/approve-vendor-dialog.tsx')
| -rw-r--r-- | lib/vendors/table/approve-vendor-dialog.tsx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/vendors/table/approve-vendor-dialog.tsx b/lib/vendors/table/approve-vendor-dialog.tsx index 253c2830..9c175dc5 100644 --- a/lib/vendors/table/approve-vendor-dialog.tsx +++ b/lib/vendors/table/approve-vendor-dialog.tsx @@ -29,6 +29,7 @@ import { } from "@/components/ui/drawer" import { Vendor } from "@/db/schema/vendors" import { approveVendors } from "../service" +import { useSession } from "next-auth/react" interface ApprovalVendorDialogProps extends React.ComponentPropsWithoutRef<typeof Dialog> { @@ -45,11 +46,19 @@ export function ApproveVendorsDialog({ }: ApprovalVendorDialogProps) { const [isApprovePending, startApproveTransition] = React.useTransition() const isDesktop = useMediaQuery("(min-width: 640px)") + const { data: session } = useSession() function onApprove() { + if (!session?.user?.id) { + toast.error("사용자 인증 정보를 찾을 수 없습니다.") + return + } + startApproveTransition(async () => { const { error } = await approveVendors({ ids: vendors.map((vendor) => vendor.id), + userId: Number(session.user.id) + }) if (error) { @@ -70,7 +79,7 @@ export function ApproveVendorsDialog({ <DialogTrigger asChild> <Button variant="outline" size="sm" className="gap-2"> <Check className="size-4" aria-hidden="true" /> - Approve ({vendors.length}) + 가입 Approve ({vendors.length}) </Button> </DialogTrigger> ) : null} |
