diff --git a/frontend/src/config.ts b/frontend/src/config.ts index 55c2a9b..ef6432d 100644 --- a/frontend/src/config.ts +++ b/frontend/src/config.ts @@ -1 +1,2 @@ export const BE_BASE_URL = "http://slackwatch-be-svc.slackwatch.svc.cluster.local/"; +//export const BE_BASE_URL = "http://localhost:8080/"; diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index b4425da..db6f5ff 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -1,12 +1,35 @@ + Pods Information - {#each podsInfo as { name, timeScanned }} + {#each data.podsInfo as { name, timeScanned }} - Image Name: {name} - Time Scanned: {timeScanned} + + {name} + {timeScanned} + + {/each} diff --git a/frontend/src/routes/+page.ts b/frontend/src/routes/+page.ts index 7ffda0b..746dc40 100644 --- a/frontend/src/routes/+page.ts +++ b/frontend/src/routes/+page.ts @@ -1,14 +1,12 @@ +import { BE_BASE_URL } from "../config"; + console.log('before'); export async function load({ fetch }: { fetch: (input: RequestInfo, init?: RequestInit) => Promise; }) { - console.log('inside'); - const response = await fetch('http://localhost:8080/api/pods'); - const text = await response.text(); // Get the raw response text - console.log('Raw response:', text); - const podsInfo = await response.json(); // Parse the response as JSON - console.log(podsInfo); - return { props: { podsInfo } }; // Return podsInfo for Svelte to use + const response = await fetch(`${BE_BASE_URL}api/pods`); + const podsInfo = await response.json(); // Parse the response as JSON + return { podsInfo }; }
Image Name: {name}
Time Scanned: {timeScanned}