41 lines
864 B
TypeScript
41 lines
864 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { apiFetch } from './api';
|
|
|
|
export interface PortfolioImage {
|
|
id: string;
|
|
portfolioEntryId: string;
|
|
url: string;
|
|
order: number;
|
|
isCover: boolean;
|
|
caption?: string;
|
|
}
|
|
|
|
export interface PortfolioTechnology {
|
|
id: string;
|
|
name: string;
|
|
iconUrl?: string;
|
|
color?: string;
|
|
}
|
|
|
|
export interface PortfolioProject {
|
|
id: string;
|
|
title: string;
|
|
clientCompanyName?: string;
|
|
publicSummary?: string;
|
|
caseStudy?: string;
|
|
solution?: string;
|
|
siteUrl?: string;
|
|
isPublished: boolean;
|
|
displayOrder: number;
|
|
technologies: PortfolioTechnology[];
|
|
images: PortfolioImage[];
|
|
}
|
|
|
|
export function usePortfolio() {
|
|
return useQuery<PortfolioProject[]>({
|
|
queryKey: ['portfolio'],
|
|
queryFn: () => apiFetch<PortfolioProject[]>('/api/portfolio/public'),
|
|
staleTime: 1000 * 60 * 5,
|
|
});
|
|
}
|