Add watch to network when user is on manage bids or transaction history
Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
|
||||
const etherStore = useEtherStore();
|
||||
|
||||
const { walletAddress } = storeToRefs(etherStore);
|
||||
const { walletAddress, networkName } = storeToRefs(etherStore);
|
||||
const depositList = ref<ValidDeposit[]>([]);
|
||||
|
||||
if (walletAddress.value) {
|
||||
@@ -46,6 +46,12 @@ watch(walletAddress, async () => {
|
||||
depositList.value = walletDeposits;
|
||||
}
|
||||
});
|
||||
|
||||
watch(networkName, async () => {
|
||||
await listValidDepositTransactionsByWalletAddress(walletAddress.value).then((res) => {
|
||||
if (res) depositList.value = res;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import { useEtherStore } from "@/store/ether";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { ref, watch } from "vue";
|
||||
import { ref, watch, onMounted } from "vue";
|
||||
import ListingComponent from "@/components/ListingComponent.vue";
|
||||
import { listAllTransactionByWalletAddress } from "@/blockchain/wallet";
|
||||
import type { Event } from "ethers";
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
|
||||
const etherStore = useEtherStore();
|
||||
const { walletAddress } = storeToRefs(etherStore);
|
||||
const { walletAddress, networkName } = storeToRefs(etherStore);
|
||||
const allUserTransactions = ref<(Event | ValidDeposit)[]>([]);
|
||||
|
||||
if (walletAddress.value) {
|
||||
onMounted(async () => {
|
||||
if (walletAddress.value) {
|
||||
await listAllTransactionByWalletAddress(walletAddress.value).then((res) => {
|
||||
if (res) allUserTransactions.value = res;
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
watch(walletAddress, async (newValue) => {
|
||||
await listAllTransactionByWalletAddress(newValue).then((res) => {
|
||||
@@ -23,12 +25,10 @@ watch(walletAddress, async (newValue) => {
|
||||
});
|
||||
});
|
||||
|
||||
watch(walletAddress, async (newValue) => {
|
||||
console.log(newValue);
|
||||
});
|
||||
|
||||
watch(allUserTransactions, (newValue) => {
|
||||
console.log(newValue);
|
||||
watch(networkName, async () => {
|
||||
await listAllTransactionByWalletAddress(walletAddress.value).then((res) => {
|
||||
if (res) allUserTransactions.value = res;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user