diff --git a/src/api.ts b/src/api.ts new file mode 100644 index 0000000..27a4382 --- /dev/null +++ b/src/api.ts @@ -0,0 +1,21 @@ +export async function fetchPods(namespace: string) { + const res = await fetch( + `/api/v1/namespaces/${namespace}/pods` + ); + return res.json(); +} + +export async function fetchLogs({ + namespace, + pod, + container +}: { + namespace: string; + pod: string; + container: string; +}) { + const url = `/api/v1/namespaces/${namespace}/pods/${pod}/log?container=${container}&tailLines=200`; + + const res = await fetch(url); + return res.text(); +} \ No newline at end of file