From fb355414ab09bfb33716b2f17a4bc1534dd7ee86 Mon Sep 17 00:00:00 2001 From: Noah Date: Sat, 2 Aug 2025 05:08:21 +0200 Subject: [PATCH] Added first steps towards user auth to the app --- frontend/src/App.jsx | 2 +- frontend/src/constants/ApiConstants.js | 1 + frontend/src/screens/JoinStation.jsx | 8 ++++-- frontend/src/screens/StationPage.jsx | 27 +++++++++++++++++-- frontend/src/utils/AddClientToStation.js | 33 ++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 frontend/src/utils/AddClientToStation.js diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 465c9cb..df00a96 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -14,7 +14,7 @@ function App() { } /> } /> } /> - } /> + } /> diff --git a/frontend/src/constants/ApiConstants.js b/frontend/src/constants/ApiConstants.js index c7fd4b7..7cdec44 100644 --- a/frontend/src/constants/ApiConstants.js +++ b/frontend/src/constants/ApiConstants.js @@ -2,3 +2,4 @@ export const RADIOSTATION_URL = "http://localhost:8080/api"; export const CREATE_RADIOSTATION_ENDPOINT = "/radio-stations"; export const LIST_RADIOSTATIONS_ENDPOINT = "/radio-stations"; +export const ADD_CLIENT_ENDPOINT = "/clients/connect"; diff --git a/frontend/src/screens/JoinStation.jsx b/frontend/src/screens/JoinStation.jsx index ed2fff4..b1f4cc1 100644 --- a/frontend/src/screens/JoinStation.jsx +++ b/frontend/src/screens/JoinStation.jsx @@ -5,10 +5,13 @@ import { getStations } from "../utils/GetStations"; function JoinStation() { const navigate = useNavigate(); const [stations, setStations] = useState([]); + const [displayName, setDisplayName] = useState(""); const handleJoinStation = (stationID) => { - console.log("Joining station with ID:" + stationID); - navigate(`/station/${stationID}`); + // console.log("Joining station with ID:" + stationID); + if (!displayName) return; // USER HAS TO HAVE DISPLAY NAME + + navigate(`/station/${stationID}/${displayName}`); }; useEffect(() => { @@ -26,6 +29,7 @@ function JoinStation() {
+