mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-19 07:54:23 +01:00
Create new workspace, and more optimizations
This commit is contained in:
@@ -3,9 +3,13 @@ import type { Workspace } from '../lib/models';
|
||||
import { convertDates } from '../lib/models';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
export function workspacesQueryKey() {
|
||||
return ['workspaces'];
|
||||
}
|
||||
|
||||
export function useWorkspaces() {
|
||||
return (
|
||||
useQuery(['workspaces'], async () => {
|
||||
useQuery(workspacesQueryKey(), async () => {
|
||||
const workspaces = (await invoke('workspaces')) as Workspace[];
|
||||
return workspaces.map(convertDates);
|
||||
}).data ?? []
|
||||
|
||||
Reference in New Issue
Block a user