Skip to main content

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.

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.

Base URL

Every request originates from the following root:
https://6a61e9edda10c59c180a02b0.mockapi.io

Axios Client

The Axios instance is defined in src/services/api.js and imported by every service module in the app:
src/services/api.js
import axios from "axios";

export default axios.create({
  baseURL: "https://6a61e9edda10c59c180a02b0.mockapi.io",
});
All service functions import this instance as 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

ResourceBase PathDescription
Doctors/DoctorsDoctor profiles and details
Appointments/AppointmentsPatient 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’s createAsyncThunk for all API calls. Errors are caught in a try/catch block and forwarded to Redux’s rejected action via rejectWithValue:
return rejectWithValue(error.response?.data || error.message);
The expression 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, open src/services/api.js and replace the baseURL value:
src/services/api.js
import axios from "axios";

export default axios.create({
  // Replace with your production or staging base URL:
  baseURL: "https://api.your-production-server.com",

  // Add default headers for authenticated endpoints:
  headers: {
    Authorization: "Bearer YOUR_TOKEN_HERE",
  },
});
No other files need to change — all service functions consume the shared instance, so this single edit propagates across both resource modules.

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.

Build docs developers (and LLMs) love