diff --git a/package.json b/package.json index 1e62d27..a554e4d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "./src/index.tsx", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "ijl-cli --server --port=8099", + "start": "ijl-cli --server --port=8099 --with-open-browser", "build": "npm run clean && ijl-cli --build --dev", "build:prod": "npm run clean && ijl-cli --build", "clean": "rimraf dist" diff --git a/src/pages/UserPage.tsx b/src/pages/UserPage.tsx index ded37df..6d6dec0 100644 --- a/src/pages/UserPage.tsx +++ b/src/pages/UserPage.tsx @@ -7,6 +7,7 @@ import arrow from '../assets/36-arrow-right.svg'; export const UserPage = () => { const [socketId, setSocketId] = useState(null); + const [error, setError] = useState(null); const { lessonId } = useParams(); useEffect(() => { connect(); @@ -26,8 +27,8 @@ export const UserPage = () => { socket.emit('add', { socketId: id || socket.id, name, lessonid: lessonId }); } }) - socket.on('lessons', data => { - // setLessons(data) + socket.on('error', data => { + setError(data) }) }, []); @@ -43,6 +44,8 @@ export const UserPage = () => { localStorage.setItem('name', value) socket.emit('add', { socketId, name: value, lessonid: lessonId }); }, [value]) + + console.log(getSocket()) return ( @@ -66,6 +69,11 @@ export const UserPage = () => { + +
+          {JSON.stringify(getSocket()?.connected, null, 4)}
+          {JSON.stringify(getSocket()?.id, null, 4)}
+        
)