AMS (Appointment Management System) communicates with a hosted REST backend powered by MockAPI. All data operations — fetching doctor profiles, booking appointments, and cancelling visits — go through a single Axios client that is pre-configured with the API’s base URL. This page describes how that client is set up, what resources are exposed, how errors are propagated through Redux, and how to point the app at a different backend when you are ready for production.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Jay-byte389/AMS/llms.txt
Use this file to discover all available pages before exploring further.
Base URL
Every request originates from the following root:Axios Client
The Axios instance is defined insrc/services/api.js and imported by every service module in the app:
src/services/api.js
api (or API) and call relative paths such as /Doctors and /Appointments. Axios automatically prepends the baseURL, so no absolute URLs appear in the service layer.
Available Resources
| Resource | Base Path | Description |
|---|---|---|
| Doctors | /Doctors | Doctor profiles and details |
| Appointments | /Appointments | Patient appointment records |
Authentication
The current MockAPI project is publicly accessible — no
Authorization header or API key is required. Every request succeeds without any credentials. If you replace the backend with a production server you will need to add authentication headers to the Axios instance (see Changing the Base URL below).Error Handling
AMS uses Redux Toolkit’screateAsyncThunk for all API calls. Errors are caught in a try/catch block and forwarded to Redux’s rejected action via rejectWithValue:
error.response?.data extracts the structured error body returned by the server (e.g. { message: "Not found" }). If the request never reached the server — for example due to a network timeout — there is no response object, so the fallback error.message is used instead (e.g. "Network Error"). The rejected payload is stored in the Redux slice’s error field and can be read by any connected component.
Changing the Base URL
To point AMS at a staging or production backend, opensrc/services/api.js and replace the baseURL value:
src/services/api.js
API Reference
Doctors API
GET /Doctors and GET /Doctors/:id — list all doctors or fetch a single profile.Appointments API
GET, POST, and PUT /Appointments — list, create, and cancel appointment records.