error to pre
This commit is contained in:
parent
109d51115b
commit
412d6377bd
@ -5,7 +5,7 @@
|
|||||||
"main": "./src/index.tsx",
|
"main": "./src/index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"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": "npm run clean && ijl-cli --build --dev",
|
||||||
"build:prod": "npm run clean && ijl-cli --build",
|
"build:prod": "npm run clean && ijl-cli --build",
|
||||||
"clean": "rimraf dist"
|
"clean": "rimraf dist"
|
||||||
|
@ -7,6 +7,7 @@ import arrow from '../assets/36-arrow-right.svg';
|
|||||||
|
|
||||||
export const UserPage = () => {
|
export const UserPage = () => {
|
||||||
const [socketId, setSocketId] = useState(null);
|
const [socketId, setSocketId] = useState(null);
|
||||||
|
const [error, setError] = useState(null);
|
||||||
const { lessonId } = useParams();
|
const { lessonId } = useParams();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
connect();
|
connect();
|
||||||
@ -26,8 +27,8 @@ export const UserPage = () => {
|
|||||||
socket.emit('add', { socketId: id || socket.id, name, lessonid: lessonId });
|
socket.emit('add', { socketId: id || socket.id, name, lessonid: lessonId });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
socket.on('lessons', data => {
|
socket.on('error', data => {
|
||||||
// setLessons(data)
|
setError(data)
|
||||||
})
|
})
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -43,6 +44,8 @@ export const UserPage = () => {
|
|||||||
localStorage.setItem('name', value)
|
localStorage.setItem('name', value)
|
||||||
socket.emit('add', { socketId, name: value, lessonid: lessonId });
|
socket.emit('add', { socketId, name: value, lessonid: lessonId });
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
|
console.log(getSocket())
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MainWrapper>
|
<MainWrapper>
|
||||||
@ -66,6 +69,11 @@ export const UserPage = () => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</InputWrapper>
|
</InputWrapper>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
{JSON.stringify(getSocket()?.connected, null, 4)}
|
||||||
|
{JSON.stringify(getSocket()?.id, null, 4)}
|
||||||
|
</pre>
|
||||||
</StartWrapper>
|
</StartWrapper>
|
||||||
</MainWrapper>
|
</MainWrapper>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user