mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
15 lines
527 B
TypeScript
15 lines
527 B
TypeScript
|
import { useContext } from "react";
|
||
|
// context
|
||
|
import { StoreContext } from "contexts/store-context";
|
||
|
// mobx store
|
||
|
import { IProjectPageStore } from "store/pages/project-page.store";
|
||
|
|
||
|
export const useProjectPages = (projectId: string | undefined): IProjectPageStore => {
|
||
|
const context = useContext(StoreContext);
|
||
|
if (context === undefined) throw new Error("useProjectPage must be used within StoreProvider");
|
||
|
|
||
|
if (!projectId) throw new Error("projectId must be passed as a property");
|
||
|
|
||
|
return context.projectPages;
|
||
|
};
|