All primary data-fetching in Ecommerce Delivery is performed with the browser’s nativeDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/ecommerce-delivery-frontend/llms.txt
Use this file to discover all available pages before exploring further.
fetch API — not Axios. Axios is registered as a Quasar boot plugin (src/boot/axios.js) and is available as this.$axios and this.$api on the Vue global properties for convenience, but the actual page and component code issues requests directly with fetch. This keeps API calls explicit and avoids a secondary abstraction layer on top of the standard Web API.
Base URL
Every API call is prefixed withprocess.env.API_SERVER, which is injected from a .env file at build time via the dotenv integration configured in quasar.config.js:
API_SERVER in your .env file at the project root:
Standard request pattern
Every API call follows the same structure:POST method, cors mode, a JSON Content-Type header, a Bearer token from the current session, and a JSON-serialised body.
sessionUser object is obtained at the top of each component’s setup() by calling getDataUser() from src/tools/User.js, which reads both the serialised user and the raw token from localStorage.
Authentication headers
Two authorization schemes appear in the source depending on the endpoint:| Scheme | Header value | Used for |
|---|---|---|
| Bearer | Authorization: Bearer <token> | Products, notifications, most endpoints |
| Basic | Authorization: Basic <token> | Some sales endpoints |
The inconsistency between
Bearer and Basic reflects the backend’s routing conventions. Check the specific endpoint in the reference table below before sending a request to confirm which scheme it expects.Standard response shape
All API responses share a common JSON envelope:| Field | Type | Description |
|---|---|---|
status | boolean | true on success, false on application-level failure |
message | string | Human-readable result message |
data | array | object | Payload — array for lists, object for single-resource responses |
pagination | object | Present on paginated endpoints; omitted for single-resource calls |
pagination.pag | number | Current page number |
pagination.perpage | number | Items per page requested |
pagination.pags | number | Total number of pages |
pagination.cant | number | Total item count across all pages |
Error handling
Immediately after parsing every API response,ValidateSession from src/tools/User.js is called with the response object and the current router instance:
401 (Unauthorised) or 403 (Forbidden) code, the function:
Redirects to /login
Calls
router.push({ path: '/login' }) to send the user back to the sign-in screen immediately.Clears localStorage
Calls
localStorage.clear() to remove the token, serialised user, and cart state so no stale credentials remain.Pagination
All list endpoints accept the current page and page size directly in the URL path:pagination object tells you the total number of pages (pags) and the total item count (cant) so your component can render correct page controls.
Full API endpoint reference
All endpoints use the
POST HTTP method — even listing and read operations. This is the backend’s global convention; do not use GET for any of these routes.| Endpoint | Purpose |
|---|---|
POST /api/user/login | Authenticate user and receive a JWT token |
POST /api/user/create | Register a new user account |
POST /api/user/list-members/:pag/:perpage | List all registered users (admin only) |
POST /api/user/update-role/:id | Update a user’s role (admin only) |
POST /api/product/list-product/:pag/:perpage | Paginated product listing |
POST /api/product/search-product/:query | Search products by name |
POST /api/product/get-product-type-prd/:type/:pag/:perpage | Filter products by shirt type |
POST /api/product/list-id/:id | Retrieve a single product by ID |
POST /api/product/create | Create a new product (admin, multipart form data) |
POST /api/product/update/:id | Update an existing product (admin, multipart form data) |
POST /api/sale/pay/:productId | Place an order for a product |
POST /api/sale/all-list/:pag/:perpage | List all sales across all users (admin) |
POST /api/sale/list-sale/:pag/:perpage | List the current user’s own orders |
POST /api/sale/get-search/:query | Search across all sales records (admin) |
POST /api/sale/status-delivery/:idSale | Update the delivery status of a sale |
POST /api/sale/export-list-sale-xlsx | Export the full sales list as an Excel file |
POST /api/notifications/list/:pag/:perpage | Paginated list of notifications for the current user |
POST /api/notification/register-token | Register an FCM device token for push notifications |
Axios boot plugin
Althoughfetch is used for all API work, src/boot/axios.js registers Axios as a Vue global for any future use:
boot entry in quasar.config.js ensures this runs before the app mounts:
this.$axios gives access to the raw Axios singleton; this.$api gives access to the pre-configured instance with a base URL. Both are available inside Vue Options API components without any additional imports.