MCPcopy Create free account
hub / github.com/codag-megalith/codag-visualizer / constructor

Method constructor

frontend/src/api.ts:39–66  ·  view source on GitHub ↗
(baseURL: string, outputChannel: vscode.OutputChannel)

Source from the content-addressed store, hash-verified

37 private baseURL: string;
38
39 constructor(baseURL: string, outputChannel: vscode.OutputChannel) {
40 this.outputChannel = outputChannel;
41 this.baseURL = baseURL;
42 this.client = axios.create({
43 baseURL,
44 timeout: 0 // No timeout - analysis can take a while
45 });
46
47 this.client.interceptors.request.use(config => {
48 this.outputChannel.appendLine(`API Request: ${config.method?.toUpperCase()} ${config.url}`);
49 return config;
50 });
51
52 this.client.interceptors.response.use(
53 response => {
54 this.outputChannel.appendLine(`API Response: ${response.status} ${response.config.url}`);
55 return response;
56 },
57 error => {
58 this.outputChannel.appendLine(`API Error: ${error.message}`);
59 if (error.response) {
60 this.outputChannel.appendLine(`Status: ${error.response.status}`);
61 this.outputChannel.appendLine(`Data: ${JSON.stringify(error.response.data)}`);
62 }
63 return Promise.reject(error);
64 }
65 );
66 }
67
68 /**
69 * Check if the backend is reachable and API key is configured.

Callers

nothing calls this directly

Calls 1

createMethod · 0.80

Tested by

no test coverage detected