rBD IS WORKING!!!! at least for now!

This commit is contained in:
RezHackXYZ 2025-05-18 12:42:44 +05:30
parent 3ad30b476a
commit 8e1cfbcb6f
No known key found for this signature in database
31 changed files with 374 additions and 81 deletions

View file

@ -1,18 +1,17 @@
import { goto } from '$app/navigation';
import { createGame } from './InsertGameInDB.js';
import { questions } from './GameCreateData.svelte.js';
import { createGame } from "./InsertGameInDB.js";
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.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');
return alert("Select correct answers");
const gamePin = Math.floor(Math.random() * 1000000)
.toString()
.padStart(6, '0');
.padStart(6, "0");
createGame(questions.v, gamePin);
await createGame(questions.v, gamePin);
goto('/host/' + gamePin);
window.location.href = "/host/" + gamePin;
}