From b1e3658eb715bdbbc00a65c27cee9215346c1e2f Mon Sep 17 00:00:00 2001 From: Aleksandr Bautin Date: Sun, 12 Nov 2023 20:31:20 +0300 Subject: [PATCH] fixed results getting & added checking for bought domain --- src/result.ts | 25 ++++++++++++++++++++++++- src/views/Checkout.vue | 7 +++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/result.ts b/src/result.ts index 7dec0c3..9c06a89 100644 --- a/src/result.ts +++ b/src/result.ts @@ -98,7 +98,30 @@ export class Result { // } export async function get_search_results(query: string) { - return Result.fromBackend(await call_api("find/" + query)); + const res = await call_api("find/" + query); + + return res.map((item: any) => ({ + ...item, + getRouteParams: () => ({ + domain_init: /* domain up to . */ item.domain.split(".")[0], + domain: /* domain up to . */ item.domain.split(".")[0], + zone: /* domain after . */ item.domain.split(".").slice(1).join("."), + }), + canAuction: () => + item.auction_price !== undefined && + item.auction_price !== null && + item.owner === undefined, + canBuy: () => + item.buy_price !== undefined && + item.buy_price !== null && + item.owner === undefined, + zone: () => item.domain.split(".").slice(1).join("."), + })); + + // canAuction + // canBuy + // zone + // return {...res, };}; /*await sleep(200); return [ new Result(query + '.ton', 5, 3), diff --git a/src/views/Checkout.vue b/src/views/Checkout.vue index cb8351e..272e2a0 100644 --- a/src/views/Checkout.vue +++ b/src/views/Checkout.vue @@ -75,6 +75,13 @@ export default { params: { domain_init: this.domain, zone: this.zone }, }); } + + let res = await get_domain_result(this.domain + "." + this.zone); + + while (res.owner !== this.$store.getters.address) { + res = await get_domain_result(this.domain + "." + this.zone); + } + this.$router.push({ name: "Explore", params: { domain: this.domain + "." + this.zone },