Some fixes after upgrading react-query

This commit is contained in:
Gregory Schier
2024-05-10 09:19:29 -07:00
parent 9f4c80ecf1
commit acc07780a7
12 changed files with 35 additions and 20 deletions

View File

@@ -1,13 +1,20 @@
import { useQuery } from '@tanstack/react-query';
import { invoke } from '@tauri-apps/api/core';
export interface AppInfo {
isDev: boolean;
version: string;
name: string;
appDataDir: string;
appLogDir: string;
}
export function useAppInfo() {
return useQuery(['appInfo'], async () => {
return (await invoke('cmd_metadata')) as {
isDev: boolean;
version: string;
name: string;
appDataDir: string;
};
return useQuery({
queryKey: ['appInfo'],
queryFn: async () => {
const metadata = await invoke('cmd_metadata');
return metadata as AppInfo;
},
});
}