SkinFirts communicates with a MockAPI REST backend through a thin API layer housed inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/BhushanBadhe39/SkinFirts/llms.txt
Use this file to discover all available pages before exploring further.
src/api/. The layer is composed of three files: a shared Axios client (Client.js) that holds the base URL and default timeout, and two resource modules (doctorsApi.js and usersApi.js) that export plain async functions consumed by Redux thunks and the useDoctors hook. Keeping transport configuration in one place means switching to a production backend requires changing a single value in Client.js.
Axios Client
All HTTP requests share a single Axios instance created insrc/api/Client.js. The instance is pre-configured with the MockAPI base URL and a 10-second request timeout, and is imported by every API module.
| Configuration | Value | Purpose |
|---|---|---|
baseURL | https://6a63416d1bffb2ffab8bf093.mockapi.io | Root URL prepended to every relative endpoint path |
timeout | 10000 ms | Aborts requests that hang for more than 10 seconds |
Doctors API
src/api/doctorsApi.js exposes two functions for reading and mutating doctor records.
fetchDoctors()
Issues a Returns:
GET request to ./doctorData and returns the full array of doctor objects.Doctor[] — the complete doctor catalogue.updateDoctors(email, updates)
Issues a Parameters:
PATCH request to ./doctorData/:email with a partial update payload and returns the updated doctor object. Despite the parameter name email, the value passed in practice is the doctor’s id field (see DoctorSlice and useDoctors).email— the doctor record identifier used as the path segmentupdates— partial object to merge (e.g.{ isFavorite: true })
Doctor — the full updated doctor object as stored by MockAPI.Full Source
Users API
src/api/usersApi.js exposes three functions covering the full create-read-update lifecycle for user records. New users are always created with a set of pre-defined appointment ID lists so that the appointment screens have seed data to render immediately after registration.
createUser(newUser)
Merges Returns:
User_PreDefined_Fields with the caller-supplied newUser payload and issues a POST to ./users/. The pre-defined fields ensure every new account starts with a realistic set of appointment history entries.User — the created user object, including the server-assigned id.fetchUsers()
Issues a Returns:
GET to ./users and returns the full array of registered users.User[] — all user records.Full Source
Pre-Defined User Appointment Fields
Every account created viacreateUser is seeded with the following appointment ID lists. The appointment screens use these IDs to look up the corresponding appointment records from the MockAPI doctorData resource.
| Field | Seeded IDs | Count |
|---|---|---|
completeAppointments | 1 – 7 | 7 |
upcomingAppointments | 15 – 40 | 26 |
cancelledAppointments | 8 – 14 | 7 |
newUser argument will override these defaults if the same key is present (spread order: pre-defined first, then newUser).
Doctor Data Fields
Doctor objects returned byfetchDoctors() carry the following fields, as used across the doctor detail and scheduling screens:
| Field | Type | Description | |
|---|---|---|---|
id | string | Unique record identifier used for PATCH routes and favorites lookup | |
doctorName | string | Full display name | |
department | string | Medical specialty (e.g. “Dermatology”) | |
img | string | Profile image URL | |
ratings | number | Average star rating | |
experience | string | Years of practice | |
focus | string[] | List of treatment focus areas | |
profile | string | Short biography paragraph | |
careerPath | object[] | Structured career history entries | |
highlights | string[] | Key achievement bullet points | |
reviews | `string | number` | Review count or summary displayed alongside the doctor’s info |
availability | `string | number` | Availability indicator displayed alongside the doctor’s info |
isFavorite | boolean | Whether the current user has favorited this doctor | |
gender | string | Doctor’s gender |
Error Handling Patterns
API functions do not catch errors internally — they let Axios throw, which allows callers to decide how to handle failures.- Redux Thunks
- useDoctors Hook
createAsyncThunk automatically catches rejections and dispatches the rejected action with action.error.message. The slice stores the message in state.error:The current
baseURL in Client.js points to a MockAPI prototype endpoint. When promoting SkinFirts to production, replace this value with your real API base URL and add any required authentication interceptors to the apiClient instance in src/api/Client.js. No other files need to change.