From e0b950f1c4bccbc6fcfbda072e00a430c081338e Mon Sep 17 00:00:00 2001 From: Arthur Wambst Date: Mon, 20 Oct 2025 20:35:22 +0200 Subject: [PATCH] fix: use new endpoint to fetch instance owner --- src/pages/Immersion.tsx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/pages/Immersion.tsx b/src/pages/Immersion.tsx index 45d1ebd..ca52ca8 100644 --- a/src/pages/Immersion.tsx +++ b/src/pages/Immersion.tsx @@ -13,6 +13,7 @@ function Immersion() { const [allInstances, setAllInstances] = useState([]); const [instancesStatus, setInstancesStatus] = useState>({}); const [containerStatus, setContainerStatus] = useState(""); + const [instancesOwner, setInstancesOwner] = useState(""); const username = localStorage.getItem("username"); const copyText = (copy: string) => { @@ -35,6 +36,21 @@ function Immersion() { }); }, [id]); + useEffect(() => { + axios.get(`/api/ji/${id}/all-instances`).then((res) => { + setAllInstances(res.data); + // Récupérer l owner de chaque instance + res.data.forEach((inst: Instance) => { + axios.get(`/api/ji/${id}/instance-owner?instId=${inst.id}`).then((ownerRes) => { + setInstancesOwner(prev => ({ + ...prev, + [inst.id]: ownerRes.data + })); + }); + }); + }); + }, [id]); + useEffect(() => { axios.get(`/api/ji/${id}/all-instances`).then((res) => { setAllInstances(res.data); @@ -328,7 +344,11 @@ function Immersion() { {index + 1} {inst.name} {inst.port} - {username} + + + {instancesOwner[inst.id] || "Loading..."} + +
{inst.password} @@ -349,7 +369,7 @@ function Immersion() {