plane/web/hooks/store/use-inbox-issues.ts
2024-03-04 18:20:18 +05:30

16 lines
564 B
TypeScript

import { useContext } from "react";
// mobx store
import { StoreContext } from "contexts/store-context";
// types
import { IInboxIssue } from "oldStore/inbox/inbox_issue.store";
import { IInboxFilter } from "oldStore/inbox/inbox_filter.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 };
};