From a19da6cda5ecafbefa9391fa6948f9ec93d63825 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Fri, 10 Jun 2022 00:43:47 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B2=BD=EB=A7=A4=EC=9E=A5=20=EA=B0=B1?= =?UTF-8?q?=EC=8B=A0=20=EB=B2=84=ED=8A=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/ts/PageAuction.vue | 30 ++++++++++++++++--------- hwe/ts/components/AuctionResource.vue | 4 ++++ hwe/ts/components/AuctionUniqueItem.vue | 19 ++++++++++++---- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/hwe/ts/PageAuction.vue b/hwe/ts/PageAuction.vue index f48b12fc..a0414015 100644 --- a/hwe/ts/PageAuction.vue +++ b/hwe/ts/PageAuction.vue @@ -4,8 +4,8 @@ 금/쌀 유니크 - - + + @@ -22,18 +22,28 @@ import TopBackBar from "@/components/TopBackBar.vue"; import BottomBar from "./components/BottomBar.vue"; import AuctionResource from "@/components/AuctionResource.vue"; import AuctionUniqueItem from "@/components/AuctionUniqueItem.vue"; -import { toRef } from "vue"; +import { ref, toRef } from "vue"; const props = defineProps({ - isResAuction: { - type: Boolean, - default: true, - }, + isResAuction: { + type: Boolean, + default: true, + }, }); -const isResAuction = toRef(props, 'isResAuction'); +const auctionResource = ref | null>(null); +const auctionUniqueItem = ref | null>(null); -function tryReload() { - console.log('갱신'); +const isResAuction = toRef(props, "isResAuction"); + +async function tryReload() { + console.log(auctionResource.value); + console.log(auctionUniqueItem.value); + if(isResAuction.value && auctionResource.value){ + await auctionResource.value.refresh(); + } + if(!isResAuction.value && auctionUniqueItem.value){ + await auctionUniqueItem.value.refresh(); + } } diff --git a/hwe/ts/components/AuctionResource.vue b/hwe/ts/components/AuctionResource.vue index e3848aee..5e2093d5 100644 --- a/hwe/ts/components/AuctionResource.vue +++ b/hwe/ts/components/AuctionResource.vue @@ -282,6 +282,10 @@ async function openAuction() { } } +defineExpose({ + refresh, +}) + onMounted(async () => { void refresh(); console.log("mounted"); diff --git a/hwe/ts/components/AuctionUniqueItem.vue b/hwe/ts/components/AuctionUniqueItem.vue index d1ecc705..988f3ce4 100644 --- a/hwe/ts/components/AuctionUniqueItem.vue +++ b/hwe/ts/components/AuctionUniqueItem.vue @@ -100,7 +100,7 @@ const obfuscatedName = ref(""); const toasts = unwrap(useToast()); -async function refresh() { +async function refreshList() { try { const result = await SammoAPI.Auction.GetUniqueItemAuctionList(); obfuscatedName.value = result.obfuscatedName; @@ -135,8 +135,7 @@ async function bidAuction() { title: "성공", body: "입찰이 완료되었습니다.", }); - void refreshDetail(); - void refresh(); + await refresh(); } catch (e) { console.error(e); if (isString(e)) { @@ -149,7 +148,19 @@ async function bidAuction() { } } +async function refresh(){ + const waiters = [ + refreshList(), + refreshDetail(), + ]; + await Promise.all(waiters); +} + +defineExpose({ + refresh +}) + onMounted(() => { - void refresh(); + void refreshList(); });