Spaces:
Running

Bot / frontend /src /features /workspace /services /workspaceService.ts
ddosvn's picture
Initial deploy of Panel ThTuanIT full stack and Lighthouse-optimized frontend
7e79d39 verified
Raw History Blame Contribute Delete
724 Bytes
import { requestJson } from '@/shared/lib/httpClient';
import { WorkspaceOwnerOption, Zone } from '../types/workspaceTypes';
export const workspaceService = {
listZones: () => requestJson<Zone[]>('/api/zones'),
createZone: (name: string, description: string, ownerId?: string) => {
const form = new FormData();
form.append('name', name);
form.append('description', description);
if (ownerId) form.append('owner_id', ownerId);
return requestJson('/api/zones', { method: 'POST', body: form });
},
deleteZone: (name: string) =>
requestJson(`/api/zones/${encodeURIComponent(name)}`, { method: 'DELETE' }),
listOwnerOptions: () => requestJson<WorkspaceOwnerOption[]>('/api/admin/users'),
};