plane/web/hooks/store/use-inbox-issues.ts
2024-03-19 20:08:35 +05:30

16 lines
564 B
TypeScript

import { useContext } from "react";
// mobx store
import { StoreContext } from "@/contexts/store-context";
// types
import { IInboxFilter } from "@/store/inbox/inbox_filter.store";
import { IInboxIssue } from "@/store/inbox/inbox_issue.store";
export const useInboxIssues = (): {
issues: IInboxIssue;
filters: IInboxFilter;
} => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useInboxIssues must be used within StoreProvider");
return { issues: context.inbox.inboxIssue, filters: context.inbox.inboxFilter };
};