remove annoying message
This commit is contained in:
parent
bafd0fb153
commit
09f50e2477
2 changed files with 4 additions and 5 deletions
|
|
@ -106,9 +106,8 @@
|
|||
socket.emit('room:join', { roomId, playerId }, (resp)=>{
|
||||
if(resp && resp.error){
|
||||
console.warn('join error', resp);
|
||||
alert(resp.error || 'Impossible de rejoindre la room');
|
||||
// redirect back to home to let user retry/create
|
||||
window.location.href = '/';
|
||||
// do not alert or force-redirect; show error in status and keep page for debugging/retry
|
||||
try{ document.getElementById('status').textContent = resp.error || 'Impossible de rejoindre la room'; }catch(e){}
|
||||
return;
|
||||
}
|
||||
myPlayerId = resp.playerId;
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ io.on('connection', (socket) => {
|
|||
socket.on('room:join', ({ roomId, playerId }, cb) => {
|
||||
const room = rooms.get(roomId);
|
||||
if (!room) return cb && cb({ error: 'room not found' });
|
||||
if (room.players.length >= 2) return cb && cb({ error: 'room full' });
|
||||
const assignedId = playerId || uuidv4();
|
||||
const assignedId = playerId || uuidv4();
|
||||
|
||||
// If this player was pending removal (disconnect during navigation), cancel removal
|
||||
if(room.removalTimers && room.removalTimers.has(assignedId)){
|
||||
|
|
@ -53,6 +52,7 @@ io.on('connection', (socket) => {
|
|||
|
||||
// If playerId corresponds to an existing player, treat this as a reconnection
|
||||
let existing = room.players.find(p => p.id === assignedId);
|
||||
|
||||
let color;
|
||||
if(existing){
|
||||
existing.socketId = socket.id;
|
||||
|
|
|
|||
Loading…
Reference in a new issue