import { PaginatedDocs } from 'payload' import { Classified } from '@/payload-types' import { stringify } from 'qs-esm' export const fetchClassifieds = async (): Promise | undefined> => { const date = new Date(); date.setHours(0, 0, 0, 0); const query = { until: { greater_than_equal: date.toISOString(), } } const stringifiedQuery = stringify( { sort: "date", where: query, limit: 50 }, { addQueryPrefix: true }, ) const response = await fetch(`http://localhost:3000/api/classifieds${stringifiedQuery}`) if (!response.ok) return undefined return response.json() }