import axios from "axios";
import type { Namespace } from "~/classes/Namespace";


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