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();
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) => {