diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index bcc9546..d6fabcc 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -14,6 +14,7 @@ "ready": "Ready", "cancel": "Cancel", "copyLink": "Copy join link", + "joinGame": "Join game", "mainScreen": "Go to main screen", "instruction": "How to play", "rules": "Game rules" diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index 251fbfb..011d86a 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -14,6 +14,7 @@ "ready": "Готов", "cancel": "Отмена", "copyLink": "Копировать ссылку для подключения", + "joinGame": "Присоединится к игре", "mainScreen": "На главный экран", "instruction": "Как играть", "rules": "Правила" diff --git a/src/stores/websocket.js b/src/stores/websocket.js index 3064f42..5771569 100644 --- a/src/stores/websocket.js +++ b/src/stores/websocket.js @@ -46,7 +46,8 @@ export const useWebsocketStore = defineStore("websocket", { break case 'join': console.log('Recieve join from ' + data.from) - if (game.owner != player.id) return // Only owner ccan process join + if (game.owner == data.from || game.opponent.id == data.from) window.location.href = window.location.origin + '/lobby/' + game.id + if (game.owner != player.id) return // Only owner can process join game.join(data.from) break case 'welcome': diff --git a/src/views/JoinView.vue b/src/views/JoinView.vue index 8e495a5..c381dec 100644 --- a/src/views/JoinView.vue +++ b/src/views/JoinView.vue @@ -22,7 +22,7 @@ if (player.id == null) player.initPlayer() websocket.init(route.params.gameId) const join = () => { - websocket.send({ + res = websocket.send({ action: 'join', from: player.id }) @@ -31,7 +31,7 @@ const join = () => {