Commit 5dabab3e authored by Chunchi Che's avatar Chunchi Che

update MatchModal.tsx

parent a35b15b6
......@@ -29,7 +29,7 @@ export const matchStore = proxy<Props>(defaultProps);
export const MatchModal: React.FC = ({}) => {
const { open } = useSnapshot(matchStore);
const { user } = useSnapshot(accountStore);
const { joined } = useSnapshot(roomStore);
const { joined, errorMsg } = useSnapshot(roomStore);
const [player, setPlayer] = useState(user?.name ?? defaultPlayer);
const [passwd, setPasswd] = useState(defaultPassword);
const [server, setServer] = useState(
......@@ -67,6 +67,15 @@ export const MatchModal: React.FC = ({}) => {
}
}, [joined]);
useEffect(() => {
// 出现错误
if (errorMsg !== undefined && errorMsg !== "") {
alert(errorMsg);
setConfirmLoading(false);
roomStore.errorMsg = undefined;
}
}, [errorMsg]);
return (
<Modal
open={open}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment