import { languageInstance } from "@shared";
import { VehicleMaintenanceSession } from "./types";

export const getVehicleSessionsApi = async (
  id: number,
  signal?: AbortSignal,
): Promise<VehicleMaintenanceSession[]> => {
  const response = await languageInstance("ru").get(`/vehicle/${id}/sessions`, {
    signal,
  });

  return Array.isArray(response.data) ? response.data : [];
};
