chore: error
This commit is contained in:
parent
ef7f27326d
commit
40844d1633
|
@ -3,6 +3,7 @@ import {
|
||||||
React,
|
React,
|
||||||
useEffect,
|
useEffect,
|
||||||
} from '@flecks/react';
|
} from '@flecks/react';
|
||||||
|
import {push} from '@flecks/react/router';
|
||||||
import {useDispatch} from '@flecks/redux';
|
import {useDispatch} from '@flecks/redux';
|
||||||
import {useSocket} from '@flecks/socket';
|
import {useSocket} from '@flecks/socket';
|
||||||
import {setSelfEntity} from '@humus/app/state';
|
import {setSelfEntity} from '@humus/app/state';
|
||||||
|
@ -21,7 +22,12 @@ function Play() {
|
||||||
// Join.
|
// Join.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const join = async () => {
|
const join = async () => {
|
||||||
|
try {
|
||||||
dispatch(setSelfEntity(await socket.send(['Join'])));
|
dispatch(setSelfEntity(await socket.send(['Join'])));
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
dispatch(push('/'));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
join();
|
join();
|
||||||
socket.on('reconnect', join);
|
socket.on('reconnect', join);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user