Commit a656c773 authored by chenqikuai's avatar chenqikuai

fix

parent 76706204
......@@ -43,12 +43,9 @@ export default Vue.extend({
this.fetchLatestTxListData();
getNodeNum().then((res) => {
if (res.error === null) {
this.nodeNum = (res.result.countries || []).reduce(
(prev: number, cur: { country: string; value: number }) => {
return prev + cur.value;
},
0
);
this.nodeNum = (res.result.countries || []).reduce((prev, cur) => {
return prev + cur.value;
}, 0);
}
});
......
import { axios } from ".";
import { axios, iJrpcRet } from ".";
const scanApi = "/setScan";
export function getNodeNum() {
export function getNodeNum(): Promise<
iJrpcRet<{
countries: {
country: string;
value: number;
}[];
}>
> {
return axios(scanApi, {
method: "post",
params: {
......
......@@ -15,3 +15,9 @@ export function axios(
return ret.json();
});
}
export interface iJrpcRet<T> {
id: number;
error: null | string;
result: T;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment