mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-17 14:37:05 +01:00
19 lines
430 B
TypeScript
19 lines
430 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { invoke } from '@tauri-apps/api';
|
|
import type { Settings } from '../lib/models';
|
|
|
|
export function settingsQueryKey() {
|
|
return ['settings'];
|
|
}
|
|
|
|
export function useSettings() {
|
|
return (
|
|
useQuery({
|
|
queryKey: settingsQueryKey(),
|
|
queryFn: async () => {
|
|
return (await invoke('cmd_get_settings')) as Settings;
|
|
},
|
|
}).data ?? undefined
|
|
);
|
|
}
|