Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is reame
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"react-router": "^6.26.2",
"react-router-dom": "^6.26.2",
"react-toastify": "^10.0.6",
"socket.io-client": "^4.8.0"
"socket.io-client": "^4.8.0",
"react-icons":"^5.5.0"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
Expand Down
25 changes: 7 additions & 18 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,22 @@ import "react-toastify/dist/ReactToastify.css";
const App = () => {
localStorage.setItem("delivery", false);

const isAuthenticated = !!localStorage.getItem("user");

const ProtectedRoute = ({element}) => {
if (!isAuthenticated) {
toast.warning("Please log in to access this page!", { position: "top-right" });
return <Navigate to="/" />;
}
return element;
};

return (
<>
<ToastContainer />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/doctors" element={<ProtectedRoute element={<Doctors />} />} />
<Route path="/medcardreg/:doctorId" element={<ProtectedRoute element={<MedCardReg />} />} />
<Route path="/meeting/:userid" element={<ProtectedRoute element={<Meeting />} />} />
<Route path="/delivary" element={<ProtectedRoute element={<DeliveryBoy />} />} />
<Route path="/track" element={<ProtectedRoute element={<TrackDelivery />} />} />
<Route path="/doc" element={<ProtectedRoute element={<Docmet />} />} />
<Route path="/doctors" element={<Doctors />} />
<Route path="/medcardreg/:doctorId" element={<MedCardReg />} />
<Route path="/meeting/:userid" element={ <Meeting />} />
<Route path="/delivary" element={ <DeliveryBoy />} />
<Route path="/track" element={ <TrackDelivery />} />
<Route path="/doc" element={ <Docmet />} />
<Route path="/error" element={<Glitch />} />
<Route path="/auth" element={<Auth />} />
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</>
);
};

export default App;
export default App;
4 changes: 2 additions & 2 deletions client/src/Components/Meeting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const socket = io("https://hospo.onrender.com");
function Meeting() {
const [stream, setStream] = useState();
const [peerId, setPeerId] = useState('');
const { id } = useParams();
const { userid } = useParams();
const peerInstance = useRef(null);
const localVideoRef = useRef();
const remoteVideoRef = useRef();
Expand All @@ -19,7 +19,7 @@ function Meeting() {
const [isConnecting, setIsConnecting] = useState(false);
const [showControls, setShowControls] = useState(true);
const nav = useNavigate();
const name = id;
const name = userid;

// Hide controls after inactivity
useEffect(() => {
Expand Down