Files
yaak/src-web/hooks/useOsInfo.ts
2024-05-04 14:14:19 -07:00

13 lines
334 B
TypeScript

import { useQuery } from '@tanstack/react-query';
import type { OsType } from '@tauri-apps/plugin-os';
import { type } from '@tauri-apps/plugin-os';
export function useOsInfo() {
return useQuery<{ osType: OsType }>({
queryKey: ['platform'],
queryFn: async () => {
return { osType: await type() };
},
}).data;
}