From 5782eeb9a45c349c2e4b43562f8a37d853fca297 Mon Sep 17 00:00:00 2001 From: Hadj Said Bouras Date: Sun, 29 Oct 2023 11:00:44 +0100 Subject: [PATCH] feat(index.jsx): change link on sign up or reset password --- src/components/loginform/index.jsx | 111 +++++++++++++++++++++++++++++ src/pages/login/index.jsx | 24 +++++++ 2 files changed, 135 insertions(+) create mode 100644 src/components/loginform/index.jsx create mode 100644 src/pages/login/index.jsx diff --git a/src/components/loginform/index.jsx b/src/components/loginform/index.jsx new file mode 100644 index 0000000..41210ac --- /dev/null +++ b/src/components/loginform/index.jsx @@ -0,0 +1,111 @@ +import React, { useState } from "react"; +import { useAuth } from "@/context/AuthContext"; +import { useNavigate } from "react-router-dom"; + +export default function LoginForm() { + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const { login, currentUser } = useAuth(); + const navigate = useNavigate(); + + function handleLogin(e) { + e.preventDefault(); + console.log("whatever"); + login(email, password) + .then(() => { + navigate("/account"); + }) + .catch((error) => { + console.log("error"); + }); + } + console.log(currentUser); + + return ( +
+
+

+ Log in +

+
+
+ + setEmail(e.target.value)} + required + /> +
+
+ + setPassword(e.target.value)} + required + /> +
+
+ +
+ +
+
+ Don't have an account?{" "} + + Sign up + + + Forgot Password? + +
+
+

Log in with:

+
+ + + +
+
+
+
+ ); +} diff --git a/src/pages/login/index.jsx b/src/pages/login/index.jsx new file mode 100644 index 0000000..610d418 --- /dev/null +++ b/src/pages/login/index.jsx @@ -0,0 +1,24 @@ +import Footer from "@/components/footer/Footer"; +import Navbar from "@/components/navbar/Navbar"; +import LoginForm from "@/components/loginform"; +import { BrowserRouter as Router } from "react-router-dom"; // Import Router +import React from "react"; + +export default function Login() { + return ( + + {" "} + {/* Wrap your components with the Router */} +
+ +
+
+ +
+
+
+
+
+ ); +}