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

update MatchModal.tsx

parent a35b15b6
Pipeline #23132 passed with stages
in 14 minutes and 31 seconds
...@@ -29,7 +29,7 @@ export const matchStore = proxy<Props>(defaultProps); ...@@ -29,7 +29,7 @@ export const matchStore = proxy<Props>(defaultProps);
export const MatchModal: React.FC = ({}) => { export const MatchModal: React.FC = ({}) => {
const { open } = useSnapshot(matchStore); const { open } = useSnapshot(matchStore);
const { user } = useSnapshot(accountStore); const { user } = useSnapshot(accountStore);
const { joined } = useSnapshot(roomStore); const { joined, errorMsg } = useSnapshot(roomStore);
const [player, setPlayer] = useState(user?.name ?? defaultPlayer); const [player, setPlayer] = useState(user?.name ?? defaultPlayer);
const [passwd, setPasswd] = useState(defaultPassword); const [passwd, setPasswd] = useState(defaultPassword);
const [server, setServer] = useState( const [server, setServer] = useState(
...@@ -67,6 +67,15 @@ export const MatchModal: React.FC = ({}) => { ...@@ -67,6 +67,15 @@ export const MatchModal: React.FC = ({}) => {
} }
}, [joined]); }, [joined]);
useEffect(() => {
// 出现错误
if (errorMsg !== undefined && errorMsg !== "") {
alert(errorMsg);
setConfirmLoading(false);
roomStore.errorMsg = undefined;
}
}, [errorMsg]);
return ( return (
<Modal <Modal
open={open} 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