Init
This commit is contained in:
22
frontend/src/services/api.js
Normal file
22
frontend/src/services/api.js
Normal file
@@ -0,0 +1,22 @@
|
||||
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');
|
||||
}
|
||||
Reference in New Issue
Block a user