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(); });