feat: Interface error interrupt request

This commit is contained in:
Alisa | Side.one 2023-06-09 20:26:39 +08:00
parent 5e03afec0a
commit 116be4db63

View File

@ -28,7 +28,7 @@ onMounted(async () => {
// stakingStore.init(); // stakingStore.init();
validatorsData.value = await stakingStore.fetchAcitveValdiators(); validatorsData.value = await stakingStore.fetchAcitveValdiators();
rpc.value = rpcList.value[0].address + '/consensus_state'; rpc.value = rpcList.value[0].address + '/consensus_state';
fetchPosition(); await fetchPosition();
update(); update();
clearTime() clearTime()
timer = setInterval(() => { timer = setInterval(() => {
@ -80,12 +80,12 @@ function color(i: number, txt: string) {
} }
return txt === 'nil-Vote' ? 'gray-700' : 'success'; return txt === 'nil-Vote' ? 'gray-700' : 'success';
} }
function onChange() { async function onChange () {
httpstatus.value = 200; httpstatus.value = 200;
httpStatusText.value = ''; httpStatusText.value = '';
roundState.value = {}; roundState.value = {};
clearTime(); clearTime();
fetchPosition(); await fetchPosition();
update(); update();
timer = setInterval(() => { timer = setInterval(() => {
update(); update();
@ -99,6 +99,7 @@ async function fetchPosition() {
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error: ${response.status}`); throw new Error(`HTTP error: ${response.status}`);
} }
httpstatus.value = response.status; httpstatus.value = response.status;
httpStatusText.value = response.statusText; httpStatusText.value = response.statusText;
@ -115,6 +116,7 @@ async function fetchPosition() {
async function update() { async function update() {
rate.value = '0%'; rate.value = '0%';
updatetime.value = new Date(); updatetime.value = new Date();
console.log(httpstatus, 'httpstatus')
if (httpstatus.value === 200) { if (httpstatus.value === 200) {
fetch(rpc.value) fetch(rpc.value)
.then((data) => { .then((data) => {