Skip to content

Commit

Permalink
Merge pull request #46 from Shaurya0108/sessions
Browse files Browse the repository at this point in the history
login page render
  • Loading branch information
Shaurya0108 authored Nov 8, 2023
2 parents 12a1c6b + f66b700 commit d522a34
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 21 deletions.
3 changes: 3 additions & 0 deletions FrontEnd/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Forum&family=Julius+Sans+One&family=PT+Serif&display=swap" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Forum&family=Julius+Sans+One&family=PT+Sans&family=PT+Serif&display=swap" rel="stylesheet">
<title>Virtual TA</title>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
.navbar-cap-2 {
margin: 0;
font-size: 20px;
margin-top: 40px;
margin-top: 30px;
width: fit-content;
margin-left: auto;
margin-right: auto;
Expand Down
1 change: 1 addition & 0 deletions FrontEnd/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function App() {

<Routes>
<Route path="/home" element={<Home/>} />
<Route path="/" element={<Login/>} />
</Routes>
);
}
1 change: 1 addition & 0 deletions FrontEnd/src/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TextBox2 from './components/TextBox2';
import Sessions from './components/SessionBar';
import Navbar from './components/Navbar';
export default function Home() {

function toggleSessions(){
var sessionContainer = document.querySelector('.session-container');
var chatContainer = document.querySelector('.chat-container');
Expand Down
43 changes: 24 additions & 19 deletions FrontEnd/src/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,39 @@ export default function Login() {
const [password, setPassword] = useState('');


// async function authorizeUser() {
// try{
// var credentials = JSON.stringify({
// "username": username,
// "password": password
// });
// var myHeaders = new Headers();
// myHeaders.append("Content-Type", "application/json");

var requestOptions = {
async function authorizeUser() {
try {
const credentials = JSON.stringify({
username,
password
});
const myHeaders = {
"Content-Type": "application/json"
};

const requestOptions = {
method: 'POST',
headers: myHeaders,
body: credentials,
redirect: 'follow',
credentials: 'include' //Make sure to have this line for every Request. Or else the cookie won't be included in the requests
credentials: 'include'
};
const response = fetch("http://18.189.195.246:443/auth/login", requestOptions);

const response = await fetch("http://18.189.195.246:443/auth/login", requestOptions);

if (response.ok) {
navigator('home');
}
else {
navigator('/home');
} else {
alert('Invalid Credentials');
}
} catch (err) {
alert(err.message);
}
}



return (

<div className="Login">
<button className="student-login">
STUDENT LOGIN
Expand All @@ -57,12 +63,11 @@ export default function Login() {
placeholder="Password"
onChange={(e) => setPassword(e.target.value)} />
{/* <button className="login-button" onClick={authorizeUser}> */}
<button className="login-button" onClick={"hello"}>
<button className="login-button" onClick={authorizeUser}>
LOGIN
</button>

</div>
</div>


)
}
2 changes: 1 addition & 1 deletion FrontEnd/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
theme: {
extend: {
fontFamily: {
sans: ['PT Serif', 'Roboto', 'sans-serif'],
sans: ['PT Sans', 'PT Serif', 'Roboto', 'sans-serif'],
},
},
},
Expand Down

0 comments on commit d522a34

Please sign in to comment.