diff --git a/users/authservice/auth-service.js b/users/authservice/auth-service.js index fb2b1bd..c6a21df 100644 --- a/users/authservice/auth-service.js +++ b/users/authservice/auth-service.js @@ -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 diff --git a/users/userservice/user-service.js b/users/userservice/user-service.js index bfb7912..85d43c8 100644 --- a/users/userservice/user-service.js +++ b/users/userservice/user-service.js @@ -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); diff --git a/webapp/public/index.html b/webapp/public/index.html index 5f84e37..0923e97 100644 --- a/webapp/public/index.html +++ b/webapp/public/index.html @@ -1,21 +1,24 @@ - - - - - - - - - - - WIQ - - - -
- - - + + + \ No newline at end of file diff --git a/webapp/public/manifest.json b/webapp/public/manifest.json index 080d6c7..9c6df9d 100644 --- a/webapp/public/manifest.json +++ b/webapp/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "React App", - "name": "Create React App Sample", + "short_name": "WIQ", + "name": "WIQ by HappySW", "icons": [ { "src": "favicon.ico", diff --git a/webapp/src/App.jsx b/webapp/src/App.jsx index 4547e92..d967959 100644 --- a/webapp/src/App.jsx +++ b/webapp/src/App.jsx @@ -1,25 +1,16 @@ -import React, { useState } from 'react'; +import React from 'react'; import {BrowserRouter, Routes, Route} from 'react-router-dom' import AddUser from './components/AddUser'; import Navbar from './components/Navbar'; import Login from './components/Login'; import Rankings from './components/Rankings'; -import CssBaseline from '@mui/material/CssBaseline'; -import Container from '@mui/material/Container'; -import Typography from '@mui/material/Typography'; -import Link from '@mui/material/Link'; -import { useEffect } from 'react'; -import axios from 'axios'; import Game from './components/Game'; -import useAuthUser from 'react-auth-kit/hooks/useAuthUser'; -import useIsAuthenticated from 'react-auth-kit/hooks/useIsAuthenticated' import MainPage from './components/MainPage'; function App() { - const [showLogin, setShowLogin] = useState(true); - const [user, setUser] = useState({}); - const isAuthenticated = useIsAuthenticated() - const auth = useAuthUser(); + // const isAuthenticated = useIsAuthenticated() // True if user has logged in + // const auth = useAuthUser(); // User data: {username,emial,createdAt} To add fields go to Login + // IDK how it works @@ -34,28 +25,6 @@ function App() { } /> - - - - - /* - - - Welcome to the 2024 edition of the Software Architecture course hola - - {showLogin ? : } - - {showLogin ? ( - - Don't have an account? Register here. - - ) : ( - - Already have an account? Login here. - - )} - - */ ) } diff --git a/webapp/src/components/AddUser.js b/webapp/src/components/AddUser.jsx similarity index 100% rename from webapp/src/components/AddUser.js rename to webapp/src/components/AddUser.jsx diff --git a/webapp/src/components/Game.jsx b/webapp/src/components/Game.jsx index 0572206..e19e95b 100644 --- a/webapp/src/components/Game.jsx +++ b/webapp/src/components/Game.jsx @@ -12,17 +12,15 @@ const Game = () => { const startGame = () => { setGameStarted(!gameStarted); }; - useEffect(() => { - if(isAuthenticated()===false) { - navigate('/login'); + if (!isAuthenticated()) { + navigate("/login"); } - } - , [isAuthenticated]); + }, [isAuthenticated, navigate]); return (
- {gameStarted ? ( + {isAuthenticated()?gameStarted ? ( ) : (
@@ -32,7 +30,7 @@ const Game = () => { Play
- )} + ):""}
) }; diff --git a/webapp/src/components/Login.js b/webapp/src/components/Login.jsx similarity index 100% rename from webapp/src/components/Login.js rename to webapp/src/components/Login.jsx