feat(admin): centralize tool & module settings in Werkzeuge tab with per-tool permissions, DB-backed config, connection tests, and cog-button navigation
This commit is contained in:
18
frontend/src/services/toolConfig.ts
Normal file
18
frontend/src/services/toolConfig.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { api } from './api';
|
||||
import type { ToolConfig, ToolTestResult } from '../types/toolConfig.types';
|
||||
|
||||
interface ApiResponse<T> {
|
||||
success: boolean;
|
||||
data: T;
|
||||
}
|
||||
|
||||
export const toolConfigApi = {
|
||||
get: (tool: string): Promise<ToolConfig> =>
|
||||
api.get<ApiResponse<ToolConfig>>(`/api/admin/tools/config/${tool}`).then(r => r.data.data),
|
||||
|
||||
update: (tool: string, config: Partial<ToolConfig>): Promise<void> =>
|
||||
api.put(`/api/admin/tools/config/${tool}`, config).then(() => {}),
|
||||
|
||||
test: (tool: string, config?: Partial<ToolConfig>): Promise<ToolTestResult> =>
|
||||
api.post<ApiResponse<ToolTestResult>>(`/api/admin/tools/config/${tool}/test`, config ?? {}).then(r => r.data.data),
|
||||
};
|
||||
Reference in New Issue
Block a user