Skip to content

Commit

Permalink
Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ask1811 committed Mar 19, 2023
1 parent 1513647 commit d6840d1
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion frontend/src/Components/Footer/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Footer = () => {
</ul>

<ul class="menu">
<li><a href="#">Home</a></li>
<li><a href="/">Home</a></li>
</ul>
</footer>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/Components/Navbar/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body {
}

.nav {
height: 60px;
height: 75px;
width: 100%;
background-color: #000;
display: flex;
Expand Down Expand Up @@ -112,4 +112,11 @@ body {
}
.nav> .nav-links> a> .replies{
font-size: 22px;
}
.nav > .nav-links > .btn4{
color: white;
background-color: red;
border-radius: 5px;
border-width: 0px;
padding: 1px 5px 1px 5px;
}
6 changes: 3 additions & 3 deletions frontend/src/Components/Navbar/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const Navbar = () => {
<span class="replies">Heart Disease</span>
<span class="comments"></span>
</a>
<button class="btn1" onClick={() => { localStorage.removeItem('token'); window.location.href='/Login'; }}>
Logout
</button>
<button class="btn4" onClick={() => { localStorage.removeItem('token'); window.location.href = '/Login'; }}>
Logout
</button>
</div>
</div >
)
Expand Down
15 changes: 13 additions & 2 deletions frontend/src/pages/Login/Login.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
}
.form {
position: relative;

width: 380px;
padding: 80px 40px 40px;
background: black;
Expand Down Expand Up @@ -125,5 +124,17 @@
}
.motham{
background-color: violet;
min-height: 100vh;
max-height: 850px;
}
.logbtn{
transition-duration: 0.4s;
border-color: red;
border-width: 3px;
background-color: red;
color: white;
margin-left: 10px;
}
.logbtn:hover {
background-color: red;

}
37 changes: 21 additions & 16 deletions frontend/src/pages/Login/Login.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState} from 'react'
import React, { useState } from 'react'
import axios from "axios";
import './Login.css'
const Login = () => {
Expand All @@ -19,19 +19,19 @@ const Login = () => {
})
}

async function login(){
async function login() {
await axios
.post(`${baseURL}/auth/signin`, {
email: logdata.email,
password: logdata.password
email: logdata.email,
password: logdata.password
})
.then((response) => {
console.log(response.data);
localStorage.setItem("token",response.data.token);
localStorage.setItem("userId",response.data.data[0]._id)
window.location.href = "/";
console.log(response.data);
localStorage.setItem("token", response.data.token);
localStorage.setItem("userId", response.data.data[0]._id)
window.location.href = "/";
});
}
}

return (
<div className='motham'>
Expand All @@ -40,7 +40,7 @@ const Login = () => {
<form name="my" class="form">
<h2>Log In</h2>
<div className="input-group">
<input type="text" name="email" id="loginUser" value = {logdata.email} onChange={addData} required />
<input type="text" name="email" id="loginUser" value={logdata.email} onChange={addData} required />
<label for="loginUser">E-mail</label>
</div>
<div className="input-group">
Expand All @@ -54,21 +54,26 @@ const Login = () => {
/>
<label for="loginPassword">Password</label>
</div>
<input type="submit" value="Sign In" class="submit-btn" onClick={(e)=>{
<input type="submit" value="Sign In" class="submit-btn" onClick={(e) => {

e.preventDefault();
console.log(logdata)
login();
}}/>
}} />

</form>
<br />
<p className='sig'>Do not have an account Click Here to Signup</p>
<a href="/signup" >Signup</a>
<p className='sig'>Do not have an account

<a href='/Signup'>
<button className='logbtn'>Signup</button>
</a>
</p>


</div >
</div >
</div>
</div >
)
}

Expand Down

0 comments on commit d6840d1

Please sign in to comment.