fix(web): add workspace context to domain and project creation (#536)
All checks were successful
ci/woodpecker/push/web Pipeline was successful
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #536.
This commit is contained in:
@@ -44,7 +44,10 @@ export interface DomainFilters {
|
||||
/**
|
||||
* Fetch all domains
|
||||
*/
|
||||
export async function fetchDomains(filters?: DomainFilters): Promise<ApiResponse<Domain[]>> {
|
||||
export async function fetchDomains(
|
||||
filters?: DomainFilters,
|
||||
workspaceId?: string
|
||||
): Promise<ApiResponse<Domain[]>> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (filters?.search) {
|
||||
@@ -60,7 +63,7 @@ export async function fetchDomains(filters?: DomainFilters): Promise<ApiResponse
|
||||
const queryString = params.toString();
|
||||
const endpoint = queryString ? `/api/domains?${queryString}` : "/api/domains";
|
||||
|
||||
return apiGet<ApiResponse<Domain[]>>(endpoint);
|
||||
return apiGet<ApiResponse<Domain[]>>(endpoint, workspaceId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,20 +76,27 @@ export async function fetchDomain(id: string): Promise<DomainWithCounts> {
|
||||
/**
|
||||
* Create a new domain
|
||||
*/
|
||||
export async function createDomain(data: CreateDomainDto): Promise<Domain> {
|
||||
return apiPost<Domain>("/api/domains", data);
|
||||
export async function createDomain(data: CreateDomainDto, workspaceId?: string): Promise<Domain> {
|
||||
return apiPost<Domain>("/api/domains", data, workspaceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a domain
|
||||
*/
|
||||
export async function updateDomain(id: string, data: UpdateDomainDto): Promise<Domain> {
|
||||
return apiPatch<Domain>(`/api/domains/${id}`, data);
|
||||
export async function updateDomain(
|
||||
id: string,
|
||||
data: UpdateDomainDto,
|
||||
workspaceId?: string
|
||||
): Promise<Domain> {
|
||||
return apiPatch<Domain>(`/api/domains/${id}`, data, workspaceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a domain
|
||||
*/
|
||||
export async function deleteDomain(id: string): Promise<Record<string, never>> {
|
||||
return apiDelete<Record<string, never>>(`/api/domains/${id}`);
|
||||
export async function deleteDomain(
|
||||
id: string,
|
||||
workspaceId?: string
|
||||
): Promise<Record<string, never>> {
|
||||
return apiDelete<Record<string, never>>(`/api/domains/${id}`, workspaceId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user