Skip to content

Commit

Permalink
fix #68 and #69
Browse files Browse the repository at this point in the history
  • Loading branch information
andrrsin committed Mar 26, 2024
1 parent 9e51a45 commit 2d1f308
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion users/authservice/auth-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const port = 8002;
app.use(express.json());

// Connect to MongoDB
const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/userdb';
const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/wiq-en1a-users';
mongoose.connect(mongoUri);

// Function to validate required fields in the request body
Expand Down
2 changes: 1 addition & 1 deletion users/userservice/user-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const port = 8001;
app.use(bodyParser.json());

// Connect to MongoDB
const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/userdb';
const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/wiq-en1a-users';
mongoose.connect(mongoUri);


Expand Down
12 changes: 5 additions & 7 deletions webapp/src/components/Game.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ const Game = () => {
const startGame = () => {
setGameStarted(!gameStarted);
};

useEffect(() => {
if(isAuthenticated()===false) {
navigate('/login');
if (!isAuthenticated()) {
navigate("/login");
}
}
, [isAuthenticated]);
}, [isAuthenticated, navigate]);

return (
<div>
{gameStarted ? (
{isAuthenticated()?gameStarted ? (
<Question />
) : (
<div className="flex flex-col items-center justify-center mt-16">
Expand All @@ -32,7 +30,7 @@ const Game = () => {
Play
</button>
</div>
)}
):""}
</div>
)
};
Expand Down

0 comments on commit 2d1f308

Please sign in to comment.