27 lines
580 B
JavaScript
27 lines
580 B
JavaScript
import { API_BASE } from '../config';
|
|
|
|
async function getJson(endpoint) {
|
|
const response = await fetch(`${API_BASE}${endpoint}`);
|
|
if (!response.ok) {
|
|
throw new Error('Respuesta no valida del servidor');
|
|
}
|
|
return response.json();
|
|
}
|
|
|
|
export async function getMenu() {
|
|
return getJson('/menu');
|
|
}
|
|
|
|
export async function getPrices() {
|
|
const data = await getJson('/prices');
|
|
return data.items || [];
|
|
}
|
|
|
|
export async function getCiStatus() {
|
|
return getJson('/health');
|
|
}
|
|
|
|
export async function getBuildHistory() {
|
|
return getJson('/builds');
|
|
}
|