mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-02-04 12:40:10 +00:00
feat: refactor overview button
This commit is contained in:
12
src/hooks/use-filter.tsx
Normal file
12
src/hooks/use-filter.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { useContext } from "react";
|
||||
import { FilterContext, FilterContextType } from "@/context/filter-context";
|
||||
|
||||
const useFilter = (): FilterContextType => {
|
||||
const context = useContext(FilterContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useFilter must be used within a FilterProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
export default useFilter;
|
||||
10
src/hooks/use-status.tsx
Normal file
10
src/hooks/use-status.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { useContext } from "react";
|
||||
import { StatusContext } from "../context/status-context";
|
||||
|
||||
export function useStatus() {
|
||||
const context = useContext(StatusContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useStatus must be used within a StatusProvider");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user