Skip to main content

Documentation 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.

SkinFirts communicates with a MockAPI-hosted backend through a small, focused API layer split across three files: src/api/Client.js (the shared Axios instance), src/api/doctorsApi.js (doctor-related requests), and src/api/usersApi.js (user-related requests). All functions are async and return the unwrapped data field from the Axios response, so callers receive plain JavaScript objects and arrays rather than raw Axios response wrappers.

apiClient

The shared Axios instance is created once in src/api/Client.js and imported by every API module. It sets two global defaults that apply to every request made through it.
src/api/Client.js
import axios from "axios";

export const apiClient = axios.create({
    baseURL: 'https://6a63416d1bffb2ffab8bf093.mockapi.io',
    timeout: 10000
});
PropertyValueDescription
baseURLhttps://6a63416d1bffb2ffab8bf093.mockapi.ioRoot URL prepended to every relative path
timeout10000 (10 s)Request is aborted and an error is thrown if the server does not respond within this period

Doctors API — src/api/doctorsApi.js

src/api/doctorsApi.js
import { apiClient } from "./Client";

export async function fetchDoctors() {
    const { data } = await apiClient.get('./doctorData');
    return data;
}

export async function updateDoctors(email, updates) {
    const { data } = await apiClient.patch(`./doctorData/${email}`, updates);
    return data;
}

fetchDoctors()

Fetches the full list of doctors from the doctorData resource. This function takes no arguments and is the primary data-loading step triggered by the loadDoctors Redux thunk. HTTP request: GET {baseURL}/doctorData Parameters: None
return
Promise<DoctorObject[]>
Resolves to an array of all doctor objects stored in the MockAPI doctorData collection.
Example — using inside a component via Redux:
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { loadDoctors } from '../redux/Slices/DoctorSlice';

export default function DoctorListScreen() {
  const dispatch = useDispatch();
  const { data: doctors, loading, error } = useSelector(state => state.doctors);

  useEffect(() => {
    dispatch(loadDoctors());
  }, [dispatch]);

  if (loading) return <ActivityIndicator />;
  if (error) return <Text>Error: {error}</Text>;

  return doctors.map(doc => <DoctorCard key={doc.id} doctor={doc} />);
}

updateDoctors(email, updates)

Sends a partial update (PATCH) to a single doctor record identified by email. In the MockAPI schema, the doctor’s id field is used as the path parameter (the argument is named email in the source but carries the record’s id value when called from toggleFavorite). HTTP request: PATCH {baseURL}/doctorData/:email
email
string
required
The unique identifier of the doctor record used as the URL path parameter. Despite the name, the Redux thunk passes doctor.id here.
updates
object
required
A partial doctor object whose fields are merged into the existing record on the server. For example, { isFavorite: true } toggles the favourite flag.
return
Promise<DoctorObject>
Resolves to the full updated doctor object as returned by MockAPI after the merge.

Users API — src/api/usersApi.js

src/api/usersApi.js
import { apiClient } from "./Client";

const User_PreDefined_Fields = {
    completeAppointments : ["1", "2", "3", "4", "5", "6", "7"],
    upcomingAppointments : ["15", "16", "17", "18", "19", "20", "21", "22", "23",
                            "24", "25", "26", "27", "28", "29", "30", "31", "32",
                            "33", "34", "35", "36", "37", "38", "39", "40"],
    cancelledAppointments : ["8", "9", "10", "11", "12", "13", "14"]
};

export async function createUser(newUser) {
    const payload = { ...User_PreDefined_Fields, ...newUser };
    const { data } = await apiClient.post(`./users/`, payload);
    return data;
}

export async function fetchUsers() {
    const { data } = await apiClient.get('./users');
    return data;
}

export async function updateUser(id, updates) {
    const { data } = await apiClient.patch(`./users/${id}`, updates);
    return data;
}

createUser(newUser)

Creates a new user record in the MockAPI users collection. Before posting, the function merges a set of pre-defined appointment seed fields (User_PreDefined_Fields) with the caller-supplied newUser object. Values in newUser take precedence over the pre-defined defaults because newUser appears on the right-hand side of the spread. HTTP request: POST {baseURL}/users/
newUser
object
required
User registration fields supplied by the sign-up form (e.g. name, email, password). These are spread on top of the pre-defined appointment seed fields before the payload is posted.
Pre-defined fields merged into every new user:
FieldTypeSeeded Values
completeAppointmentsstring[]["1","2","3","4","5","6","7"]
upcomingAppointmentsstring[]["15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40"]
cancelledAppointmentsstring[]["8","9","10","11","12","13","14"]
return
Promise<UserObject>
Resolves to the newly created user object including the server-assigned id and all merged fields.

fetchUsers()

Fetches every user record from the users resource. This is used by loginUser in authService.js to perform client-side credential matching. HTTP request: GET {baseURL}/users Parameters: None
return
Promise<UserObject[]>
Resolves to an array of all user objects in the MockAPI users collection.

updateUser(id, updates)

Sends a partial update (PATCH) to a single user record identified by its numeric string id. HTTP request: PATCH {baseURL}/users/:id
id
string
required
The user’s unique numeric string ID as assigned by MockAPI (e.g. "42"). Used as the URL path parameter.
updates
object
required
A partial user object whose fields are merged into the existing record. For example, { name: "Jane" } updates only the name field.
return
Promise<UserObject>
Resolves to the complete updated user object as returned by MockAPI after the merge.

Build docs developers (and LLMs) love