From 9c643dc40952cfef14ff776df2e89022523a9ddc Mon Sep 17 00:00:00 2001 From: ccamel Date: Thu, 8 Jun 2023 14:54:40 +0200 Subject: [PATCH 1/3] fix: improve bech32 regex (to support all prefixes) --- src/layouts/components/NavbarSearch.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/components/NavbarSearch.vue b/src/layouts/components/NavbarSearch.vue index 9cc1b6f6..d4202878 100644 --- a/src/layouts/components/NavbarSearch.vue +++ b/src/layouts/components/NavbarSearch.vue @@ -31,7 +31,7 @@ function confirm() { } const height = /^\d+$/; const txhash = /^[A-Z\d]{64}$/; - const addr = /^[a-z]+1[a-z\d]{38,58}$/; + const addr = /^[a-z\d]+1[a-z\d]{38,58}$/; const current = blockStore?.current?.chainName || ''; const routeParams = vueRouters?.currentRoute?.value; From 5e03afec0ada267b28219dfa8c25bb51c8566782 Mon Sep 17 00:00:00 2001 From: "Alisa | Side.one" Date: Fri, 9 Jun 2023 20:19:57 +0800 Subject: [PATCH 2/3] feat: The timer is cleared uniformly --- src/modules/[chain]/consensus/index.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/[chain]/consensus/index.vue b/src/modules/[chain]/consensus/index.vue index 6e55dbb0..970871b2 100644 --- a/src/modules/[chain]/consensus/index.vue +++ b/src/modules/[chain]/consensus/index.vue @@ -20,7 +20,7 @@ let rate = ref(''); let height = ref(''); let round = ref(''); let step = ref(''); -let timer = null; +let timer = null as any; let updatetime = ref(new Date()); let positions = ref([]); let validatorsData = ref([] as any); @@ -30,14 +30,19 @@ onMounted(async () => { rpc.value = rpcList.value[0].address + '/consensus_state'; fetchPosition(); update(); + clearTime() timer = setInterval(() => { update(); }, 6000); }); onUnmounted(() => { - timer = null; + clearTime(); }); +function clearTime() { + clearInterval(timer); + timer = null; +} const newTime = computed(() => { return format.toDay(updatetime.value, 'time'); }); @@ -79,7 +84,7 @@ function onChange() { httpstatus.value = 200; httpStatusText.value = ''; roundState.value = {}; - timer = null; + clearTime(); fetchPosition(); update(); timer = setInterval(() => { From 116be4db632372f4d5e071299a1c2a56cf5209f7 Mon Sep 17 00:00:00 2001 From: "Alisa | Side.one" Date: Fri, 9 Jun 2023 20:26:39 +0800 Subject: [PATCH 3/3] feat: Interface error interrupt request --- src/modules/[chain]/consensus/index.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/[chain]/consensus/index.vue b/src/modules/[chain]/consensus/index.vue index 970871b2..97f5e267 100644 --- a/src/modules/[chain]/consensus/index.vue +++ b/src/modules/[chain]/consensus/index.vue @@ -28,7 +28,7 @@ onMounted(async () => { // stakingStore.init(); validatorsData.value = await stakingStore.fetchAcitveValdiators(); rpc.value = rpcList.value[0].address + '/consensus_state'; - fetchPosition(); + await fetchPosition(); update(); clearTime() timer = setInterval(() => { @@ -80,12 +80,12 @@ function color(i: number, txt: string) { } return txt === 'nil-Vote' ? 'gray-700' : 'success'; } -function onChange() { +async function onChange () { httpstatus.value = 200; httpStatusText.value = ''; roundState.value = {}; clearTime(); - fetchPosition(); + await fetchPosition(); update(); timer = setInterval(() => { update(); @@ -99,6 +99,7 @@ async function fetchPosition() { if (!response.ok) { throw new Error(`HTTP error: ${response.status}`); } + httpstatus.value = response.status; httpStatusText.value = response.statusText; @@ -115,6 +116,7 @@ async function fetchPosition() { async function update() { rate.value = '0%'; updatetime.value = new Date(); + console.log(httpstatus, 'httpstatus') if (httpstatus.value === 200) { fetch(rpc.value) .then((data) => {