|
|
|
// import {call_api} from "@/api";
|
|
|
|
|
|
|
|
export class Result {
|
|
|
|
domain: string;
|
|
|
|
buy_price?: number;
|
|
|
|
auction_price?: number;
|
|
|
|
owner?: string;
|
|
|
|
|
|
|
|
constructor(domain: string, buy_price?: number, auction_price?: number, owner?: string) {
|
|
|
|
this.domain = domain;
|
|
|
|
this.buy_price = buy_price;
|
|
|
|
this.auction_price = auction_price;
|
|
|
|
this.owner = owner;
|
|
|
|
}
|
|
|
|
|
|
|
|
getRouteParams(): any {
|
|
|
|
return {
|
|
|
|
domain_init: /* domain up to . */ this.domain.split('.')[0],
|
|
|
|
zone: /* domain after . */ this.domain.split('.').slice(1).join('.')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
canAuction(): boolean {
|
|
|
|
return this.auction_price !== undefined && this.auction_price !== null;
|
|
|
|
}
|
|
|
|
|
|
|
|
canBuy(): boolean {
|
|
|
|
return this.buy_price !== undefined && this.buy_price !== null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const sleep = (milliseconds: number) => {
|
|
|
|
return new Promise(resolve => setTimeout(resolve, milliseconds))
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function get_search_results(query: string) {
|
|
|
|
// return await call_api('find/' + query);
|
|
|
|
await sleep(1000);
|
|
|
|
return [
|
|
|
|
new Result(query + '.ton', 5, 3),
|
|
|
|
new Result(query + '.ton', 1),
|
|
|
|
new Result(query + '.ton', undefined, 2),
|
|
|
|
new Result(query + '.ton', undefined, undefined, '123')
|
|
|
|
];
|
|
|
|
}
|