xiongzhu 2 lat temu
rodzic
commit
3e5511bae1
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      src/views/HomeView.vue

+ 5 - 2
src/views/HomeView.vue

@@ -95,7 +95,7 @@
 </template>
 
 <script setup>
-import { ref, onMounted, inject } from 'vue'
+import { ref, onMounted, inject, watch } from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { http } from '@/plugins/http'
 import { ethers, Wallet } from 'ethers'
@@ -103,6 +103,9 @@ import { Copy, ArrowNarrowRight, ArrowsRightLeft } from '@vicons/tabler'
 import { useClipboard, useFileDialog } from '@vueuse/core'
 
 const network = inject('network')
+watch(network, () => {
+    getAccounts()
+})
 const accounts = ref([])
 const table = ref(null)
 const addForm = ref({})
@@ -193,7 +196,7 @@ async function saveAccount() {
 }
 
 async function getAccounts() {
-    const res = await http.get('/accounts/my')
+    const res = await http.get('/accounts/my', { network: network.value })
     accounts.value = res
 }
 onMounted(() => {