From 40844d16332aedaf7e027322ad5b2aa5327b769e Mon Sep 17 00:00:00 2001 From: cha0s Date: Thu, 24 Mar 2022 08:05:16 -0500 Subject: [PATCH] chore: error --- packages/app/src/components/app/play/index.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/app/play/index.jsx b/packages/app/src/components/app/play/index.jsx index e0331f6..8a8dd72 100644 --- a/packages/app/src/components/app/play/index.jsx +++ b/packages/app/src/components/app/play/index.jsx @@ -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);