iniciada creacion del mcp
All checks were successful
Deploy conversation layer / deploy (push) Successful in 6s
All checks were successful
Deploy conversation layer / deploy (push) Successful in 6s
This commit is contained in:
15
mcp/lib/api.js
Normal file
15
mcp/lib/api.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export const API_BASE_URL = process.env.PLANILLA_API_URL || "http://localhost:4000";
|
||||
|
||||
export async function fetchJSON(path, options = {}) {
|
||||
const method = options.method || "GET";
|
||||
console.log(`[API] ${method} ${API_BASE_URL}${path}`);
|
||||
const res = await fetch(`${API_BASE_URL}${path}`, {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
...options,
|
||||
});
|
||||
if (!res.ok) {
|
||||
const txt = await res.text();
|
||||
throw new Error(`API request failed (${res.status}): ${txt}`);
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
Reference in New Issue
Block a user