mirror of
https://github.com/hanzo-io/chat.git
synced 2026-10-30 18:57:58 +00:00
19 lines
560 B
TypeScript
19 lines
560 B
TypeScript
import { useContext } from 'react'
|
|
import { ChannelListContext } from '../providers/ChannelListProvider'
|
|
|
|
/**
|
|
* Hook to get the DM channels from the channel list provider. Also returns if the channel list is loading or not.
|
|
* @param props
|
|
* @returns
|
|
*/
|
|
const useGetDirectMessageChannels = () => {
|
|
|
|
const channelListContextData = useContext(ChannelListContext)
|
|
|
|
return {
|
|
dmChannels: channelListContextData?.dm_channels ?? [],
|
|
isLoading: channelListContextData?.isLoading ?? false
|
|
}
|
|
}
|
|
|
|
export default useGetDirectMessageChannels |