fix: 경매장 갱신 버튼
This commit is contained in:
+20
-10
@@ -4,8 +4,8 @@
|
||||
<BButton @click="isResAuction = true">금/쌀</BButton>
|
||||
<BButton @click="isResAuction = false">유니크</BButton>
|
||||
</TopBackBar>
|
||||
<AuctionResource v-if="isResAuction"></AuctionResource>
|
||||
<AuctionUniqueItem v-else></AuctionUniqueItem>
|
||||
<AuctionResource v-if="isResAuction" ref="auctionResource"></AuctionResource>
|
||||
<AuctionUniqueItem v-else ref="auctionUniqueItem"></AuctionUniqueItem>
|
||||
<BottomBar type="close"></BottomBar>
|
||||
</BContainer>
|
||||
</template>
|
||||
@@ -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<InstanceType<typeof AuctionResource> | null>(null);
|
||||
const auctionUniqueItem = ref<InstanceType<typeof AuctionUniqueItem> | 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();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -282,6 +282,10 @@ async function openAuction() {
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
refresh,
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
void refresh();
|
||||
console.log("mounted");
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user