2023-12-14 11:56:16 +00:00
|
|
|
import { useContext } from "react";
|
|
|
|
// mobx store
|
2023-12-18 07:18:50 +00:00
|
|
|
import { StoreContext } from "contexts/store-context";
|
2023-12-14 11:56:16 +00:00
|
|
|
// types
|
2023-12-15 09:28:40 +00:00
|
|
|
import { ILabelRootStore } from "store/label";
|
2023-12-14 11:56:16 +00:00
|
|
|
|
2023-12-15 09:28:40 +00:00
|
|
|
export const useLabel = (): ILabelRootStore => {
|
2023-12-18 07:18:50 +00:00
|
|
|
const context = useContext(StoreContext);
|
|
|
|
if (context === undefined) throw new Error("useLabel must be used within StoreProvider");
|
2023-12-15 09:28:40 +00:00
|
|
|
return context.labelRoot;
|
2023-12-14 11:56:16 +00:00
|
|
|
};
|