fix: Add getListing method to API client
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled

This commit is contained in:
2025-12-10 17:33:06 +01:00
parent c18df13337
commit 44475d08b4
2 changed files with 31 additions and 1 deletions

View File

@ -73,7 +73,7 @@ export default function BuyDomainPage() {
setLoading(true)
setError(null)
try {
const data = await api.request<Listing>(`/listings/${slug}`)
const data = await api.getListing(slug)
setListing(data)
} catch (err: any) {
setError(err.message || 'Listing not found')

View File

@ -432,6 +432,36 @@ class ApiClient {
}>(`/tld-prices/overview?${params.toString()}`)
}
// Listings (Marketplace)
async getListings(params?: {
search?: string
tld?: string
min_price?: number
max_price?: number
sort_by?: string
limit?: number
offset?: number
}) {
const query = new URLSearchParams()
if (params) {
Object.entries(params).forEach(([key, value]) => {
if (value !== undefined && value !== null) {
query.append(key, String(value))
}
})
}
return this.request<{
listings: any[]
total: number
limit: number
offset: number
}>(`/listings?${query.toString()}`)
}
async getListing(slug: string) {
return this.request<any>(`/listings/${slug}`)
}
async getTldHistory(tld: string, days = 90) {
return this.request<{
tld: string