38 lines
930 B
TypeScript
38 lines
930 B
TypeScript
'use client';
|
|
|
|
import { ServiceCard } from '@/components/shared/service-card';
|
|
import { useCustomerQuery } from '@/hooks/api/customers';
|
|
import { useServicesQuery } from '@/hooks/api/services';
|
|
import Link from 'next/link';
|
|
|
|
export function ServicesList() {
|
|
const { data: { customer } = {}, isLoading } = useCustomerQuery();
|
|
|
|
const { data: { services } = {} } = useServicesQuery({
|
|
filters: {
|
|
master: {
|
|
documentId: {
|
|
eq: customer?.documentId,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
if (isLoading || !customer) return null;
|
|
|
|
return (
|
|
<div className="space-y-2 px-6">
|
|
{services?.map(
|
|
(service) =>
|
|
service && (
|
|
<div key={service.documentId}>
|
|
<Link href={`/profile/services/${service.documentId}`}>
|
|
<ServiceCard key={service.documentId} {...service} />
|
|
</Link>
|
|
</div>
|
|
),
|
|
)}
|
|
</div>
|
|
);
|
|
}
|