error to pre

This commit is contained in:
Primakov Alexandr Alexandrovich 2023-04-16 12:30:42 +03:00
parent 109d51115b
commit 412d6377bd
2 changed files with 11 additions and 3 deletions

View File

@ -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"

View File

@ -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)
})
}, []);
@ -44,6 +45,8 @@ export const UserPage = () => {
socket.emit('add', { socketId, name: value, lessonid: lessonId });
}, [value])
console.log(getSocket())
return (
<MainWrapper>
<StartWrapper>
@ -66,6 +69,11 @@ export const UserPage = () => {
</IconButton>
</InputWrapper>
</form>
<pre>
{JSON.stringify(getSocket()?.connected, null, 4)}
{JSON.stringify(getSocket()?.id, null, 4)}
</pre>
</StartWrapper>
</MainWrapper>
)