/** @jsx jsx */ import { Button, CircularProgress, Container, Link, Typography } from "@material-ui/core"; import axios from "axios"; import { useState } from "react"; import { Box, Flex, jsx } from "theme-ui"; const API_ENDPOINT = process.env.NODE_ENV === "development" ? "http://localhost:4000" : "/api" type PSeries = { 'p80-1': number, 'p95-1': number, 'p99-1': number, 'p80-24': number, 'p95-24': number, 'p99-24': number, 'p80-168': number, 'p95-168': number, 'p99-168': number, } type TSeries = { 1: number, 24: number, 168: number, 720?: number, 2160?: number, } type Stats = { 'ttfb': PSeries, 'download_small': PSeries, 'download_throughput': PSeries, 'download_total': TSeries, 'upload_small': PSeries, 'upload_throughput': PSeries, 'upload_total': TSeries, 'money_spent': TSeries, 'total_files_pinned': number, 'total_files_served': TSeries, } const Stats = () => { const [loading, setLoading] = useState(true) const [stats, setStats] = useState() if (loading) { axios.get(`${API_ENDPOINT}/stats`) .then((response: any) => { console.log(response) setLoading(false) setStats(response.data as Stats) }).catch(e => { console.log('ERROR:', e) }) } return ( <> Sia Skynet

Portal Statistics

{loading && } {!loading && JSON.stringify(stats) }
) } export default Stats