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


export function getNamespaces(onSuccess: (namespaces: Namespace[]) => void)
{
    axios.get<Namespace[]>(StringUtils.format("%s/namespaces", ApiConfig.getHttpBase()), {
        headers: {
            Authorization: "Bearer " + requireToken()
        }
    })
    .then((response) => {
        onSuccess(response.data);
    })
    .catch();
}