Files
desktop/app/providers/SystemProvider/useSystemInformation.ts
2026-01-31 02:59:35 +02:00

30 lines
782 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useContext } from "react";
import { SystemProviderContext } from "./SystemProvider";
/**
* Информация о системе и устройстве
*/
export interface SystemInformation {
/**
* Уникальный обезличенный идентификатор устройства
*/
id: string;
/**
* Имя устройства
*/
name: string;
/**
* Операционная система устройства
*/
os: string;
}
export function useSystemInformation() : SystemInformation {
const context = useContext(SystemProviderContext);
if(!context) {
throw new Error("useSystemInformation must be used within a SystemProvider");
}
return context as SystemInformation;
}