'use server';

import { IProjectCardProps } from '@/components/pages/project/project';
import api from '@/lib/axios';
import { IResponse } from '@/models/response';
import { cookies } from 'next/headers';

export async function getProjects() {
  const cookiesStore = await cookies();
  return api
    .get('/projects', {
      headers: {
        Cookie: cookiesStore.toString(),
      },
 
    })
    .then(({ data }) => Promise.resolve(data.data))
    .catch((error) => Promise.reject(error));
}

// export async function getProjectById(
//   projectId: string,
// ): Promise<IProjectCardProps> {
//   const cookiesStore = await cookies();
//   return api
//     .get(`/projects/${projectId}`, {
//       headers: {
//         Cookie: cookiesStore.toString(),
//       },
//     })
//     .then(({ data }) => Promise.resolve(data.data))
//     .catch((error) => Promise.reject(error));
// }
