import axios from "axios";

export class Log
{
    constructor (
        public podName: string,
        public timestamp: string,
        public message: string
    ) {}
}

export function getLogs(podId: string | undefined, onSuccess: (logs: Log[]) => void)
{
    axios.get<Log[]>(ApiConfig.getHttpBase() + '/pods/' + podId + "/logs", {
        headers: {
            Authorization: "Bearer " + requireToken()
        }
    })
    .then((response) => {
        onSuccess(response.data);
    });
}