@@ -18,67 +18,67 @@ import { useRouter } from "next/navigation";
1818import { ReactNode , useState } from "react" ;
1919import { toast } from "sonner" ;
2020
21- export function LeaveWorkspaceDialog ( {
21+ export function LeaveOrganizationDialog ( {
2222 children,
23- workspaceId ,
23+ organizationId ,
2424} : {
2525 children ?: ReactNode ;
26- workspaceId : string ;
26+ organizationId : string ;
2727} ) {
2828 const [ open , setOpen ] = useState ( false ) ;
2929 const router = useRouter ( ) ;
3030
3131 const queryClient = useQueryClient ( ) ;
3232
33- const leaveWorkspaceMutation = useMutation (
34- orpc . workspace . leave . mutationOptions ( {
33+ const leaveOrganizationMutation = useMutation (
34+ orpc . organization . leave . mutationOptions ( {
3535 onSuccess : ( ) => {
3636 queryClient . invalidateQueries ( {
37- queryKey : orpc . workspace . list . queryKey ( ) ,
37+ queryKey : orpc . organization . list . queryKey ( ) ,
3838 } ) ;
3939 queryClient . invalidateQueries ( {
40- queryKey : orpc . workspace . members . list . queryKey ( ) ,
40+ queryKey : orpc . organization . members . list . queryKey ( ) ,
4141 } ) ;
4242
43- router . push ( "/workspaces " ) ;
44- toast . success ( "Workspace left successfully!" ) ;
43+ router . push ( "/organizations " ) ;
44+ toast . success ( "Organization left successfully!" ) ;
4545 setOpen ( false ) ;
4646 } ,
4747 onError : ( error ) => {
48- toast . error ( "Failed to leave workspace " , {
48+ toast . error ( "Failed to leave organization " , {
4949 description : error . message ,
5050 } ) ;
5151 } ,
5252 } )
5353 ) ;
5454
5555 function handleConfirm ( ) {
56- leaveWorkspaceMutation . mutate ( { organizationId : workspaceId } ) ;
56+ leaveOrganizationMutation . mutate ( { organizationId : organizationId } ) ;
5757 }
5858
5959 return (
6060 < Dialog open = { open } onOpenChange = { setOpen } >
6161 < DialogTrigger asChild >
6262 { children ?? (
6363 < Button variant = "destructive" size = "sm" >
64- Leave Workspace
64+ Leave Organization
6565 </ Button >
6666 ) }
6767 </ DialogTrigger >
6868 < DialogContent className = "sm:max-w-sm" >
6969 < DialogHeader >
7070 < DialogTitle > Delete Message</ DialogTitle >
7171 < DialogDescription >
72- Are you sure you want to leave this workspace ? This action cannot be
73- undone.
72+ Are you sure you want to leave this organization ? This action cannot
73+ be undone.
7474 </ DialogDescription >
7575 </ DialogHeader >
7676
7777 < DialogFooter className = "gap-2" >
7878 < DialogClose asChild >
7979 < Button
8080 variant = "outline"
81- disabled = { leaveWorkspaceMutation . isPending }
81+ disabled = { leaveOrganizationMutation . isPending }
8282 >
8383 Cancel
8484 </ Button >
@@ -88,15 +88,15 @@ export function LeaveWorkspaceDialog({
8888 < Button
8989 variant = "destructive"
9090 onClick = { handleConfirm }
91- disabled = { leaveWorkspaceMutation . isPending }
91+ disabled = { leaveOrganizationMutation . isPending }
9292 >
93- { leaveWorkspaceMutation . isPending ? (
93+ { leaveOrganizationMutation . isPending ? (
9494 < >
9595 < Loader2 className = "size-4 animate-spin" />
9696 Please wait...
9797 </ >
9898 ) : (
99- "Leave Workspace "
99+ "Leave Organization "
100100 ) }
101101 </ Button >
102102 </ DialogFooter >
0 commit comments