Skip to content

Commit

Permalink
Merge pull request #19 from HackTheTunnels:#10-Login-Page-Form
Browse files Browse the repository at this point in the history
Completed Add Login Page Form #10
  • Loading branch information
Maiku3 authored Sep 30, 2023
2 parents 5f16a45 + a5239e3 commit 0808dbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/src/pages/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import "./Login.style.scss";

function Login() {
const [message, setMessage] = useState(null);
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const { loggedIn, login } = useAccountContext();
const navigate = useNavigate();

const attemptLogin = async () => {
try {
const message = await login("admin@email.com", "password");
const message = await login(email, password);
setMessage(message);
} catch (error) {
console.log(error);
setMessage(error.message);
}
};

Expand All @@ -28,6 +30,8 @@ function Login() {
<Page>
<div className="login-page">
<h1>Login</h1>
<input type="text" placeholder="Email" onChange={(e) => setEmail(e.target.value)}/><br/><br/>
<input type="password" placeholder="Password" onChange={(e) => setPassword(e.target.value)}/><br/><br/>
<button onClick={() => attemptLogin()}>
Login (as user set in code)
</button>
Expand Down

0 comments on commit 0808dbc

Please sign in to comment.