diff --git a/src/client/Components/App.tsx b/src/client/Components/App.tsx index 4b33a61..fed2f2b 100644 --- a/src/client/Components/App.tsx +++ b/src/client/Components/App.tsx @@ -13,10 +13,9 @@ const LOGOUT_URL = hostUrl + "/logout"; // extract a preselected source from the url: const urlParams = new URLSearchParams(window.location.search); -const preSelectedSource = parseInt(urlParams.get("select") || '') || -1; +const preSelectedSource = parseInt(urlParams.get("select") || "") || -1; console.log("selectedSource :", preSelectedSource); - socketClient.on("connect", () => { fetch(USERINFO_URL) .then((res) => res.json()) @@ -27,7 +26,7 @@ socketClient.on("connect", () => { }) .catch((err) => { console.log("No authorization groups recevied :", err); - const userGroups = ['default']; + const userGroups = ["default"]; socketClient.emit(IO.GET_SOURCES, userGroups); }); }); @@ -39,6 +38,9 @@ const App = () => { useEffect(() => { socketClient.on(IO.SOURCE_LIST, (receivedSources: ISourceClients[]) => { + if (receivedSources.length === 0) { + return; + } setSources([...receivedSources]); if (preSelectedSource > 0) { setIsSelected(preSelectedSource - 1); @@ -49,11 +51,11 @@ const App = () => { return (
- - - +
{isSelected > -1 ? (