mirror of
https://github.com/idrainformatica/PecFlow.git
synced 2026-06-16 12:45:42 +02:00
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { apiClient } from './client'
|
|
import type { TenantResponse, TenantCreateRequest, TenantUpdateRequest } from '@/types/api.types'
|
|
|
|
export const tenantsApi = {
|
|
list(): Promise<TenantResponse[]> {
|
|
return apiClient.get<TenantResponse[]>('/tenants').then((r) => r.data)
|
|
},
|
|
|
|
get(id: string): Promise<TenantResponse> {
|
|
return apiClient.get<TenantResponse>(`/tenants/${id}`).then((r) => r.data)
|
|
},
|
|
|
|
create(data: TenantCreateRequest): Promise<TenantResponse> {
|
|
return apiClient.post<TenantResponse>('/tenants', data).then((r) => r.data)
|
|
},
|
|
|
|
update(id: string, data: TenantUpdateRequest): Promise<TenantResponse> {
|
|
return apiClient.patch<TenantResponse>(`/tenants/${id}`, data).then((r) => r.data)
|
|
},
|
|
|
|
suspend(id: string): Promise<TenantResponse> {
|
|
return apiClient.patch<TenantResponse>(`/tenants/${id}`, { is_active: false }).then((r) => r.data)
|
|
},
|
|
|
|
activate(id: string): Promise<TenantResponse> {
|
|
return apiClient.patch<TenantResponse>(`/tenants/${id}`, { is_active: true }).then((r) => r.data)
|
|
},
|
|
}
|