mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 13:43:39 +01:00
16 lines
385 B
TypeScript
16 lines
385 B
TypeScript
import { invoke } from '@tauri-apps/api';
|
|
import type { Workspace } from '../lib/models';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
|
export function workspacesQueryKey() {
|
|
return ['workspaces'];
|
|
}
|
|
|
|
export function useWorkspaces() {
|
|
return (
|
|
useQuery(workspacesQueryKey(), async () => {
|
|
return (await invoke('workspaces')) as Workspace[];
|
|
}).data ?? []
|
|
);
|
|
}
|