Skip to content

Commit 5a71808

Browse files
authored
Merge pull request #728 from Adamant-im/feat/no-connection-snackbar
feat: add state condition for online checker
2 parents 60e87c6 + 573d23d commit 5a71808

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/SendFundsForm.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ import klyIndexer from '@/lib/nodes/kly-indexer'
192192
import { AllNodesDisabledError, AllNodesOfflineError, NoInternetConnectionError } from '@/lib/nodes/utils/errors'
193193
import { PendingTransactionError } from '@/lib/pending-transactions'
194194
import axios from 'axios'
195-
import { nextTick } from 'vue'
195+
import { computed, nextTick } from 'vue'
196196
197197
import QrcodeCapture from '@/components/QrcodeCapture.vue'
198198
import QrcodeScannerDialog from '@/components/QrcodeScannerDialog.vue'
@@ -233,6 +233,7 @@ import { AllCryptos } from '@/lib/constants/cryptos'
233233
import { MAX_UINT64 } from '@klayr/validator'
234234
235235
import { mdiDotsVertical, mdiMenuDown } from '@mdi/js'
236+
import { useStore } from 'vuex'
236237
237238
238239
/**
@@ -284,7 +285,16 @@ export default {
284285
},
285286
emits: ['send', 'error'],
286287
setup() {
288+
const store = useStore()
289+
290+
const isOnline = computed(() => store.getters['isOnline'])
291+
292+
const checkIsOnline = () => {
293+
return navigator.onLine || isOnline.value;
294+
}
295+
287296
return {
297+
checkIsOnline,
288298
mdiDotsVertical,
289299
mdiMenuDown
290300
}
@@ -804,7 +814,7 @@ export default {
804814
})
805815
},
806816
async sendFunds() {
807-
if (!navigator.onLine) {
817+
if (!this.checkIsOnline()) {
808818
throw new NoInternetConnectionError()
809819
}
810820

0 commit comments

Comments
 (0)