Private
Public Access
1
0

chg: dev: refactor the code - there was unnecessary codes and wrongly formatted or designed code that are related to Repositories #7

This commit is contained in:
2026-04-20 11:10:00 +02:00
parent cd93a26c2c
commit f493f94368
7 changed files with 122 additions and 143 deletions

View File

@@ -294,7 +294,7 @@ const useServerCommunication = (gameAssoc, gameInherited, opponentName, isEnvDev
onSuccess: () => {
showOverlay('Challenge accepted!', 'Waiting for the challenger to join...');
},
}
},
);
};
@@ -311,7 +311,7 @@ const useServerCommunication = (gameAssoc, gameInherited, opponentName, isEnvDev
/>
) : '');
},
}
},
);
};
@@ -457,7 +457,12 @@ const useServerCommunication = (gameAssoc, gameInherited, opponentName, isEnvDev
/** Open event source after showing overlay */
openEventSource();
} else {
await startMutation.mutateAsync();
const startResponse = await startMutation.mutateAsync();
if (!startResponse?.success) {
showOverlay('Error', 'Failed to start game. Please try again.');
isEnvDev && console.error('Start game failed:', startResponse);
return;
}
openEventSource();
wInit();
}
@@ -467,6 +472,7 @@ const useServerCommunication = (gameAssoc, gameInherited, opponentName, isEnvDev
startHeartbeat();
} catch (e) {
isEnvDev && console.error('Connection error', e);
showOverlay('Error', 'Connection failed. Please try again.');
setTimeout(() => window.location.reload(), 500);
}
})();