mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-17 22:21:26 +01:00
Variables under Environment, and render all props
This commit is contained in:
1 parent
eb1cd1c14b
commit
15087f2d5a
17 files changed
+263
-275
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
import type { Variable } from '../lib/models';
|
||||
|
||||
export function variablesQueryKey({ environmentId }: { environmentId: string }) {
|
||||
return ['variables', { environmentId }];
|
||||
}
|
||||
|
||||
export function useVariables({ environmentId }: { environmentId: string }) {
|
||||
return (
|
||||
useQuery({
|
||||
queryKey: variablesQueryKey({ environmentId }),
|
||||
queryFn: async () => {
|
||||
return (await invoke('list_variables', { environmentId })) as Variable[];
|
||||
},
|
||||
}).data ?? []
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user