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
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:
@ -73,7 +73,7 @@ export default function BuyDomainPage() {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
try {
|
try {
|
||||||
const data = await api.request<Listing>(`/listings/${slug}`)
|
const data = await api.getListing(slug)
|
||||||
setListing(data)
|
setListing(data)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setError(err.message || 'Listing not found')
|
setError(err.message || 'Listing not found')
|
||||||
|
|||||||
@ -432,6 +432,36 @@ class ApiClient {
|
|||||||
}>(`/tld-prices/overview?${params.toString()}`)
|
}>(`/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) {
|
async getTldHistory(tld: string, days = 90) {
|
||||||
return this.request<{
|
return this.request<{
|
||||||
tld: string
|
tld: string
|
||||||
|
|||||||
Reference in New Issue
Block a user