mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-06-03 06:29:56 +08:00
12 lines
391 B
TypeScript
12 lines
391 B
TypeScript
import { createContext, useContext } from 'react';
|
|
import type { SystemStatus } from '../api/config';
|
|
|
|
export const SystemContext = createContext<SystemStatus | null>(null);
|
|
|
|
export const useSystemStatus = () => {
|
|
const context = useContext(SystemContext);
|
|
if (context === undefined) {
|
|
throw new Error('useSystemStatus must be used within a SystemProvider');
|
|
}
|
|
return context;
|
|
}; |