update system messages
This commit is contained in:
30
app/providers/SystemProvider/useSystemInformation.ts
Normal file
30
app/providers/SystemProvider/useSystemInformation.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user