Fix useJoinRequestMutation (#10730)
This commit is contained in:
@@ -39,14 +39,16 @@ export function useJoinRequestMutation<A extends JoinRequestAction>(
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async ({member}: {member: string}) => {
|
mutationFn: async ({member}: {member: string}) => {
|
||||||
if (!convoId) throw new Error('No convoId provided')
|
if (!convoId) throw new Error('No convoId provided')
|
||||||
const endpoint =
|
const {data} =
|
||||||
action === 'approve'
|
action === 'approve'
|
||||||
? agent.chat.bsky.group.approveJoinRequest
|
? await agent.chat.bsky.group.approveJoinRequest(
|
||||||
: agent.chat.bsky.group.rejectJoinRequest
|
{convoId, member},
|
||||||
const {data} = await endpoint(
|
{headers: DM_SERVICE_HEADERS, encoding: 'application/json'},
|
||||||
{convoId, member},
|
)
|
||||||
{headers: DM_SERVICE_HEADERS, encoding: 'application/json'},
|
: await agent.chat.bsky.group.rejectJoinRequest(
|
||||||
)
|
{convoId, member},
|
||||||
|
{headers: DM_SERVICE_HEADERS, encoding: 'application/json'},
|
||||||
|
)
|
||||||
return data as JoinRequestOutput<A>
|
return data as JoinRequestOutput<A>
|
||||||
},
|
},
|
||||||
onMutate: ({member}) => {
|
onMutate: ({member}) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user