diff --git a/trivia-forge/frontend/src/Pages/TriviaReviewPage.jsx b/trivia-forge/frontend/src/Pages/TriviaReviewPage.jsx index 2b028a1..8dd7765 100644 --- a/trivia-forge/frontend/src/Pages/TriviaReviewPage.jsx +++ b/trivia-forge/frontend/src/Pages/TriviaReviewPage.jsx @@ -18,9 +18,9 @@ function TriviaReviewPage() { console.log(game) - const HandleSaveGame = () => { - UpdateAllForGame(game); + const HandleSaveGame = async () => { updateGame(game) + await UpdateAllForGame(game); navigate('/myTrivia'); }; diff --git a/trivia-forge/frontend/src/Services/Services.jsx b/trivia-forge/frontend/src/Services/Services.jsx index 419fdf8..3a1a475 100644 --- a/trivia-forge/frontend/src/Services/Services.jsx +++ b/trivia-forge/frontend/src/Services/Services.jsx @@ -1,28 +1,6 @@ import * as db from './TF-db_services'; -import { Game } from '../Models/Game'; -import { Category } from '../Models/Category'; -import { Question } from '../Models/Question'; -import { Choice } from '../Models/Choice'; - -// export const AddAllForGame = async (game) => { -// const newGame = await db.addGame(game); -// game.categories.forEach(async (category) => { -// category.gameID = newGame.id; -// const newCategory = await db.addCategory(category); -// category.questions.forEach(async (question) => { -// console.log("Added Category ID", category.id); -// question.categoryID = newCategory.id; -// const newQuestion = await db.addQuestion(question); -// question.choices.forEach(async (choice) => { -// choice.questionID = newQuestion.id; -// await db.addChoice(choice); -// }); -// }); -// }); -// return newGame; -// } export const AddAllForGame = async (game) => { try { // Add the game to the database