import axios from "axios";
import type { NodeStats } from "~/classes/Node";


export function getNodes(onSuccess: (nodes: NodeStats[]) => void)
{
    axios.get<NodeStats[]>(useRuntimeConfig().public.apiBase + '/nodes', {
        headers: {
            Authorization: "Bearer " + requireToken()
        }
    })
    .then((response) => {
        onSuccess(response.data);
    })
    .catch();
}