-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into improve-cloud-erro…
…r-messages
- Loading branch information
Showing
17 changed files
with
195 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...eteor/client/views/room/Header/Omnichannel/QuickActions/hooks/usePutChatOnHoldMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { IRoom } from '@rocket.chat/core-typings'; | ||
import { useEndpoint } from '@rocket.chat/ui-contexts'; | ||
import { useMutation, UseMutationOptions, UseMutationResult, useQueryClient } from '@tanstack/react-query'; | ||
|
||
export const usePutChatOnHoldMutation = ( | ||
options?: Omit<UseMutationOptions<void, Error, IRoom['_id']>, 'mutationFn'>, | ||
): UseMutationResult<void, Error, IRoom['_id']> => { | ||
const putChatOnHold = useEndpoint('POST', '/v1/livechat/room.onHold'); | ||
|
||
const queryClient = useQueryClient(); | ||
|
||
return useMutation( | ||
async (rid) => { | ||
await putChatOnHold({ roomId: rid }); | ||
}, | ||
{ | ||
...options, | ||
onSuccess: async (data, rid, context) => { | ||
await queryClient.invalidateQueries(['current-chats']); | ||
await queryClient.invalidateQueries(['rooms', rid]); | ||
await queryClient.invalidateQueries(['subscriptions', { rid }]); | ||
return options?.onSuccess?.(data, rid, context); | ||
}, | ||
}, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...r/client/views/room/Header/Omnichannel/QuickActions/hooks/useReturnChatToQueueMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { IRoom } from '@rocket.chat/core-typings'; | ||
import { useMethod } from '@rocket.chat/ui-contexts'; | ||
import { useMutation, UseMutationOptions, UseMutationResult, useQueryClient } from '@tanstack/react-query'; | ||
|
||
export const useReturnChatToQueueMutation = ( | ||
options?: Omit<UseMutationOptions<void, Error, IRoom['_id']>, 'mutationFn'>, | ||
): UseMutationResult<void, Error, IRoom['_id']> => { | ||
const returnChatToQueue = useMethod('livechat:returnAsInquiry'); | ||
|
||
const queryClient = useQueryClient(); | ||
|
||
return useMutation( | ||
async (rid) => { | ||
await returnChatToQueue(rid); | ||
}, | ||
{ | ||
...options, | ||
onSuccess: async (data, rid, context) => { | ||
await queryClient.invalidateQueries(['current-chats']); | ||
queryClient.removeQueries(['rooms', rid]); | ||
queryClient.removeQueries(['subscriptions', { rid }]); | ||
return options?.onSuccess?.(data, rid, context); | ||
}, | ||
}, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.