You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 line
449B

  1. import { useContext, useEffect } from "react";
  2. import { DashboardLayoutContext } from "contexts/DashboardLayoutContext";
  3. import { PageID, TabID } from "pages";
  4. export default function useDashboard(pageId?: PageID, tabId?: TabID) {
  5. const context = useContext(DashboardLayoutContext);
  6. useEffect(() => {
  7. if (pageId) {
  8. context.setPageId(pageId);
  9. }
  10. if (tabId) {
  11. context.setTabId(tabId);
  12. }
  13. }, []);
  14. return context;
  15. }