From 78a7c0658e1f9c4f2fb239ee3dd04c0fa80f9972 Mon Sep 17 00:00:00 2001 From: Amandine Date: Thu, 10 Oct 2024 12:24:59 +0200 Subject: [PATCH] Revert "Front - Panier - WIP - Change le realtime de supabase par websocket" This reverts commit 16d680b65edc0dc40fea9964b6bc1a81ab269f58. --- packages/panier/components/PanierRealtime/index.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/panier/components/PanierRealtime/index.tsx b/packages/panier/components/PanierRealtime/index.tsx index 66f24852ece..c70890b4f29 100644 --- a/packages/panier/components/PanierRealtime/index.tsx +++ b/packages/panier/components/PanierRealtime/index.tsx @@ -58,14 +58,9 @@ const PanierRealtime = ({ }, [panier.collectivite_preset, setCollectiviteId]); useEffect(() => { - const socket: Socket = io('http://localhost:3000'); - socket.on('panierUpdate', (panierId) => { - if (panierId === panier.id) { - router.refresh(); - } - }); + const channel = panierAPI.listenToPanierUpdates(panier.id, router.refresh); return () => { - socket.disconnect(); + supabase.removeChannel(channel); }; }, [router, panier.id, setUser]);