File tree Expand file tree Collapse file tree 1 file changed +0
-41
lines changed
Expand file tree Collapse file tree 1 file changed +0
-41
lines changed Original file line number Diff line number Diff line change @@ -66,47 +66,6 @@ export function usePendingInvitations(workspaceId: string | undefined) {
6666 } )
6767}
6868
69- interface SendInvitationParams {
70- workspaceId : string
71- email : string
72- permission : 'admin' | 'write' | 'read'
73- }
74-
75- /**
76- * Sends a single workspace invitation.
77- * Invalidates the invitation list cache on success.
78- */
79- export function useSendWorkspaceInvitation ( ) {
80- const queryClient = useQueryClient ( )
81-
82- return useMutation ( {
83- mutationFn : async ( { workspaceId, email, permission } : SendInvitationParams ) => {
84- const response = await fetch ( '/api/workspaces/invitations' , {
85- method : 'POST' ,
86- headers : { 'Content-Type' : 'application/json' } ,
87- body : JSON . stringify ( {
88- workspaceId,
89- email,
90- role : 'member' ,
91- permission,
92- } ) ,
93- } )
94-
95- if ( ! response . ok ) {
96- const error = await response . json ( )
97- throw new Error ( error . error || 'Failed to send invitation' )
98- }
99-
100- return response . json ( )
101- } ,
102- onSuccess : ( _data , variables ) => {
103- queryClient . invalidateQueries ( {
104- queryKey : invitationKeys . list ( variables . workspaceId ) ,
105- } )
106- } ,
107- } )
108- }
109-
11069interface BatchSendInvitationsParams {
11170 workspaceId : string
11271 invitations : Array < { email : string ; permission : 'admin' | 'write' | 'read' } >
You can’t perform that action at this time.
0 commit comments