mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
151c355177
* fix: fixed `usePage` hook returning context instead of IPageStore * fix: updated recent pages with `updated_at` instead of `created_at` * fix: thown error instead of returning empty array
12 lines
366 B
TypeScript
12 lines
366 B
TypeScript
import { useContext } from "react";
|
|
// mobx store
|
|
import { StoreContext } from "contexts/store-context";
|
|
// types
|
|
import { IPageStore } from "store/page.store";
|
|
|
|
export const usePage = (): IPageStore => {
|
|
const context = useContext(StoreContext);
|
|
if (context === undefined) throw new Error("usePage must be used within StoreProvider");
|
|
return context.page;
|
|
};
|