mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-18 06:57:11 +01:00
14 lines
413 B
TypeScript
14 lines
413 B
TypeScript
import { invoke } from '@tauri-apps/api';
|
|
import type { Workspace } from '../lib/models';
|
|
import { convertDates } from '../lib/models';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
|
export function useWorkspaces() {
|
|
return (
|
|
useQuery(['workspaces'], async () => {
|
|
const workspaces = (await invoke('workspaces')) as Workspace[];
|
|
return workspaces.map(convertDates);
|
|
}).data ?? []
|
|
);
|
|
}
|