chore: error

This commit is contained in:
cha0s 2022-03-24 08:05:16 -05:00
parent ef7f27326d
commit 40844d1633

View File

@ -3,6 +3,7 @@ import {
React,
useEffect,
} from '@flecks/react';
import {push} from '@flecks/react/router';
import {useDispatch} from '@flecks/redux';
import {useSocket} from '@flecks/socket';
import {setSelfEntity} from '@humus/app/state';
@ -21,7 +22,12 @@ function Play() {
// Join.
useEffect(() => {
const join = async () => {
dispatch(setSelfEntity(await socket.send(['Join'])));
try {
dispatch(setSelfEntity(await socket.send(['Join'])));
}
catch (error) {
dispatch(push('/'));
}
};
join();
socket.on('reconnect', join);