import api from "../axios";
import { API_ENDPOINTS } from "../endpoints";
import { ApiResponse, PortalsListResponseSchema, TPortal } from "../types";

export const portalsService = {
    getPortals: async (): Promise<ApiResponse<TPortal[]>> => {
        try {
            const response = await api.get(API_ENDPOINTS.PORTALS.GET);
            return PortalsListResponseSchema.parse(response.data);
        } catch (error) {
            console.error("ERROR caught in portals service => getPortals", error);
            throw error;
        }
    },
};