Files
clash-verge-rev-lite/src/providers/chain-proxy-context.ts
Sline 0b4403b67b refactor: frontend (#5068)
* refactor: setting components

* refactor: frontend

* fix: settings router
2025-10-15 18:57:44 +08:00

21 lines
535 B
TypeScript

import { createContext, use } from "react";
export interface ChainProxyContextType {
isChainMode: boolean;
setChainMode: (isChain: boolean) => void;
chainConfigData: string | null;
setChainConfigData: (data: string | null) => void;
}
export const ChainProxyContext = createContext<ChainProxyContextType | null>(
null,
);
export const useChainProxy = () => {
const context = use(ChainProxyContext);
if (!context) {
throw new Error("useChainProxy must be used within a ChainProxyProvider");
}
return context;
};