You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/shared/redux/hooks/useInbox.ts

19 lines
456 B
TypeScript

import type { InboxItem } from '../../model/inbox';
import { useAppSelector } from './useAppSelector';
/**
* 返回收件箱列表
*/
export function useInboxList(): InboxItem[] {
return useAppSelector((state) => state.chat.inbox ?? []);
}
/**
* 返回收件箱某一项的值
*/
export function useInboxItem(inboxItemId: string): InboxItem | null {
const list = useInboxList();
return list.find((item) => item._id === inboxItemId) ?? null;
}