Skip to content

Commit

Permalink
Updated HandleSaveGame function on TriviaReviewPage to be asynchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanueposu committed May 30, 2024
1 parent efc7956 commit f3ebeae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
4 changes: 2 additions & 2 deletions trivia-forge/frontend/src/Pages/TriviaReviewPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function TriviaReviewPage() {

console.log(game)

const HandleSaveGame = () => {
UpdateAllForGame(game);
const HandleSaveGame = async () => {
updateGame(game)
await UpdateAllForGame(game);
navigate('/myTrivia');
};

Expand Down
22 changes: 0 additions & 22 deletions trivia-forge/frontend/src/Services/Services.jsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f3ebeae

Please sign in to comment.