diff --git a/src/app/dashboard/settings/workspaces/page.tsx b/src/app/dashboard/settings/workspaces/page.tsx new file mode 100644 index 0000000..7467cd6 --- /dev/null +++ b/src/app/dashboard/settings/workspaces/page.tsx @@ -0,0 +1,64 @@ +'use client'; + +import { useQuery } from '@tanstack/react-query'; +import { apiFetch } from '../../../../lib/api'; +import type { TenantMembership } from '../../../../lib/api'; +import { useSession } from '../../../../components/session-provider'; + +export default function WorkspacesPage() { + const { activeTenant } = useSession(); + const tenantId = activeTenant?.tenantId ?? ''; + + const { data: me, isLoading } = useQuery({ + queryKey: ['me-workspaces'], + queryFn: () => apiFetch<{ userId: string; tenants: TenantMembership[] }>('/v1/me', { tenantId }), + staleTime: 60_000, + }); + + const tenantList = me?.tenants ?? []; + + return ( +
+
+

Workspace-uri

+

+ Toate workspace-urile la care ai acces ({tenantList.length}). +

+
+ + {isLoading ? ( +

Se încarcă…

+ ) : tenantList.length === 0 ? ( +
+

Niciun workspace găsit.

+
+ ) : ( + + )} +
+ ); +}