Repository navigation
API Integration
Alexapop edited this page Oct 6, 2026
·
1 revision
All requests go through the shared Axios instance (src/services/api.js), with baseURL = VITE_API_BASE_URL. Every service declares its endpoints as constants.
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| POST | /api/v1/auth/login |
Login form | Public |
| GET | /api/v1/auth/me |
Load the current user and role | Session |
| GET | /api/v1/auth/refresh |
Automatic session renewal (api.js) |
Public |
| GET | /api/v1/auth/logout |
User menu | Session |
| POST | /api/v1/users |
Registration form | Public |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| GET | /api/v1/products?page={n}&size={n} |
Carta | Public |
| GET | /api/v1/products/administration |
Admin products (includes unavailable ones) | ADMIN |
| POST | /api/v1/products |
Admin: create product | ADMIN |
| PATCH | /api/v1/products/{id} |
Admin: edit / activate / deactivate | ADMIN |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| GET |
/api/v1/tables/by-device + header Device-Identifier
|
Automatic table detection | Session |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| POST |
/api/v1/orders + OrderDTORequest
|
Order confirmation | Public |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| GET | /api/v1/offers |
Profile, cart discounts | Customer |
| PATCH | /api/v1/offers/consume/{coupon} |
After confirming an order | Customer |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| GET | /api/v1/kitchen/orders |
Active orders list | COOK, ADMIN |
| GET | /api/v1/kitchen/metrics |
Kitchen metrics | COOK, ADMIN |
| PATCH |
/api/v1/kitchen/orders/{id}/status + { "status": "READY" }
|
Change order status (PROCESSING, DELAYED, READY) |
COOK, ADMIN |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| GET | /api/v1/delivery/metrics |
Delivery summary (every 10 s) | DELIVERY, ADMIN |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| GET | /api/v1/invoices |
Admin invoicing table | ADMIN |
| Method | Endpoint | Used in | Access |
|---|---|---|---|
| GET | /api/v1/kpi/sales |
Admin sales KPIs | ADMIN |
| GET | /api/v1/reports/sales?period={period} |
Admin sales summary | ADMIN |
| GET |
/api/v1/reports/sales.pdf (responseType: 'blob') |
PDF download | ADMIN |
{
"items": [
{ "productId": 1, "quantity": 2 },
{ "productId": 7, "quantity": 1 }
],
"chefNote": "Sin wasabi, palillos extra",
"channel": "ONSITE",
"paymentMethod": "CASH_ONSITE"
}Internal frontend values are translated in src/constants/ before being sent:
| Concept | Frontend value | Backend enum |
|---|---|---|
| Channel | sala |
ONSITE |
| Channel | domicilio |
ONLINE |
| Payment |
cashier (Pago en caja) |
CASH_ONSITE |
| Payment |
cardOnTable (Tarjeta en mesa) |
CARD_ONSITE |
| Payment |
onlineCard (Tarjeta online) |
ONLINE_CARD |
| Payment |
cashOnDelivery (Efectivo a la entrega) |
CASH_ON_DELIVERY |
Backend paymentStatus
|
Label shown to the customer |
|---|---|
PENDING_CASH |
Pendiente de cobro en caja |
PENDING_CARD_TERMINAL |
Pago pendiente en mesa |
###Pagination
The backend returns Spring's Page<T> (content, totalElements, totalPages, number — zero-based). Services normalize it into { items, page, size, totalItems, totalPages } so components don't depend on Spring's format; usePagination and PaginationControl.vue are reused by every paginated list.
| Status | Frontend behavior |
|---|---|
| Network error | Error message in the view (e.g. "No se ha podido cargar la carta"), with retry where it makes sense |
400 |
Validation message, form data is kept |
401 |
Automatic session refresh; if it fails, session cleared and redirect to Login when needed |
403 |
Redirect to Acceso denegado (logged-in users) |
404 |
Specific message (e.g. no table linked to this device → manual input) |
| Mock | Replaces | Reason |
|---|---|---|
src/mocks/orderHistory.mock.js |
Order history and "repeat order" | Backend endpoint not available yet |