trying to get the host game lobby work with the newer rDB
This commit is contained in:
parent
caff3cef7c
commit
2b9b5c3b39
20 changed files with 213 additions and 355 deletions
|
@ -5,13 +5,14 @@ import { questions } from './GameCreateData.svelte.js';
|
|||
export async function startGame() {
|
||||
if (questions.v.some((q) => q.name === '')) return alert('Please fill all questions');
|
||||
if (questions.v.some((q) => q.answers.some((a) => a === ''))) return alert('Fill all options');
|
||||
if (questions.v.some((q) => q.correctAnswer === undefined)) return alert('Select correct answers');
|
||||
if (questions.v.some((q) => q.correctAnswer === undefined))
|
||||
return alert('Select correct answers');
|
||||
|
||||
const gamePin = Math.floor(Math.random() * 1000000)
|
||||
.toString()
|
||||
.padStart(6, '0');
|
||||
|
||||
createGame($state.snapshot(questions), gamePin);
|
||||
createGame(questions.v, gamePin);
|
||||
|
||||
goto('/host/' + gamePin);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue