27 lines
648 B
TypeScript
27 lines
648 B
TypeScript
import axios from "axios";
|
|
import type { Ingress } from "~/classes/Ingress";
|
|
|
|
export function getIngresses(namespace: string | undefined, onSuccess: (ingresses: Ingress[]) => void)
|
|
{
|
|
axios.get<Ingress[]>(useRuntimeConfig().public.apiBase + '/ingresses', {
|
|
headers: {
|
|
Authorization: "Bearer " + requireToken()
|
|
},
|
|
params: getParams(namespace)
|
|
})
|
|
.then(response => {
|
|
onSuccess(response.data);
|
|
})
|
|
.catch();
|
|
}
|
|
|
|
function getParams(namespace: string | undefined)
|
|
{
|
|
if(namespace != undefined)
|
|
{
|
|
return {
|
|
namespace: namespace
|
|
}
|
|
}
|
|
return undefined;
|
|
} |