-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: get contacts from new endpoint
- Loading branch information
1 parent
f327f82
commit 9adee07
Showing
2 changed files
with
26 additions
and
25 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
10 changes: 6 additions & 4 deletions
10
apps/meteor/client/views/omnichannel/directory/contacts/hooks/useCurrentContacts.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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import type { GETLivechatRoomsParams, OperationResult } from '@rocket.chat/rest-typings'; | ||
import type { OperationResult, PaginatedRequest } from '@rocket.chat/rest-typings'; | ||
import { useEndpoint } from '@rocket.chat/ui-contexts'; | ||
import type { UseQueryResult } from '@tanstack/react-query'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
export const useCurrentContacts = ( | ||
query: GETLivechatRoomsParams, | ||
): UseQueryResult<OperationResult<'GET', '/v1/livechat/visitors.search'>> => { | ||
const currentContacts = useEndpoint('GET', '/v1/livechat/visitors.search'); | ||
query: PaginatedRequest<{ | ||
searchText: string; | ||
}>, | ||
): UseQueryResult<OperationResult<'GET', '/v1/omnichannel/contacts.search'>> => { | ||
const currentContacts = useEndpoint('GET', '/v1/omnichannel/contacts.search'); | ||
|
||
return useQuery(['current-contacts', query], () => currentContacts(query)); | ||
}; |