fix check connection
This commit is contained in:
parent
77084c3aff
commit
c8beb839af
@ -138,7 +138,7 @@ const GamePage: FunctionComponent<{
|
|||||||
const checkHasAnOngoingAction = () => hasOngoingAction;
|
const checkHasAnOngoingAction = () => hasOngoingAction;
|
||||||
|
|
||||||
const onLeaveGameClick = () => {
|
const onLeaveGameClick = () => {
|
||||||
if(Util.checkConnectionAndMaybeAlert(context)) return;
|
if (Util.checkConnectionAndMaybeAlert(context)) return;
|
||||||
swal({
|
swal({
|
||||||
title: context.texts.AreYouSureToLeaveGame,
|
title: context.texts.AreYouSureToLeaveGame,
|
||||||
icon: "warning",
|
icon: "warning",
|
||||||
@ -153,7 +153,7 @@ const GamePage: FunctionComponent<{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onNewGameClick = () => {
|
const onNewGameClick = () => {
|
||||||
if(Util.checkConnectionAndMaybeAlert(context)) return;
|
if (Util.checkConnectionAndMaybeAlert(context)) return;
|
||||||
navigate("/loby")
|
navigate("/loby")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,6 +161,7 @@ const GamePage: FunctionComponent<{
|
|||||||
if (!game || isSpectator || !userKey) {
|
if (!game || isSpectator || !userKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Util.checkConnectionAndMaybeAlert(context)) return;
|
||||||
if (game.mancalaGame.getPlayerIdByIndex(index) !== userKey) {
|
if (game.mancalaGame.getPlayerIdByIndex(index) !== userKey) {
|
||||||
notyf.error(context.texts.UCanOnlyPlayYourOwnPits);
|
notyf.error(context.texts.UCanOnlyPlayYourOwnPits);
|
||||||
return;
|
return;
|
||||||
@ -174,7 +175,6 @@ const GamePage: FunctionComponent<{
|
|||||||
notyf.error(context.texts.UMustWaitUntilCurrentMoveComplete);
|
notyf.error(context.texts.UMustWaitUntilCurrentMoveComplete);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Util.checkConnectionAndMaybeAlert(context)) return;
|
|
||||||
if (!boardViewModel) return;
|
if (!boardViewModel) return;
|
||||||
//TODO: this check should be in mancala.js
|
//TODO: this check should be in mancala.js
|
||||||
if (pit.stoneCount === 0) {
|
if (pit.stoneCount === 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user