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, 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);