e434c439c9
- Rename all component files to PascalCase matching exported names - Move components into feature directories (git/, session/, project/, terminal/, workspace/, ui/, layout/) - Rename all page files to PascalCase with Page suffix - Rename all API files to kebab-case - Update all imports across codebase with corrected relative depths - Preserve git history via git mv Quality gates: tsc (pass), eslint (pass), 66/74 tests pass (8 pre-existing failures) Refs: repo-restructure Task 4.4
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import { apiClient } from "./client";
|
|
import type { ToolConfig, CreateToolConfigRequest } from "../types/tool-config";
|
|
|
|
export type { ToolConfig, CreateToolConfigRequest } from "../types/tool-config";
|
|
|
|
export const listToolConfigs = async (
|
|
tool_type_id?: string,
|
|
project_id?: string,
|
|
): Promise<ToolConfig[]> => {
|
|
const params = new URLSearchParams();
|
|
if (tool_type_id) params.append("tool_type_id", tool_type_id);
|
|
if (project_id) params.append("project_id", project_id);
|
|
|
|
const response = await apiClient.get<{ configs: ToolConfig[] }>(
|
|
`/tool-configs?${params.toString()}`,
|
|
);
|
|
return response.data.configs;
|
|
};
|
|
|
|
export const createToolConfig = async (
|
|
data: CreateToolConfigRequest,
|
|
): Promise<ToolConfig> => {
|
|
const response = await apiClient.post<{ configs: ToolConfig[] }>(
|
|
"/tool-configs",
|
|
data,
|
|
);
|
|
return response.data.configs[0];
|
|
};
|
|
|
|
export const updateToolConfig = async (
|
|
id: string,
|
|
data: CreateToolConfigRequest,
|
|
): Promise<ToolConfig> => {
|
|
const response = await apiClient.put<{ configs: ToolConfig[] }>(
|
|
`/tool-configs/${id}`,
|
|
data,
|
|
);
|
|
return response.data.configs[0];
|
|
};
|
|
|
|
export const deleteToolConfig = async (id: string): Promise<void> => {
|
|
await apiClient.delete(`/tool-configs/${id}`);
|
|
};
|
|
|
|
export const getToolConfigDefaults = async (
|
|
toolTypeId: string,
|
|
): Promise<ToolConfig> => {
|
|
const response = await apiClient.get<ToolConfig>(
|
|
`/tool-configs/defaults/${toolTypeId}`,
|
|
);
|
|
return response.data;
|
|
};
|