added toastify to signin and signup
This commit is contained in:
+20
-17
@@ -1,26 +1,29 @@
|
||||
import Navbar from './components/Navbar'
|
||||
import {BrowserRouter as Router,Routes, Route} from 'react-router-dom'
|
||||
import Explore from './pages/Explore'
|
||||
import Profile from './pages/Profile'
|
||||
import ForgotPassword from './pages/ForgotPassword'
|
||||
import Offers from './pages/Offers'
|
||||
import Signin from './pages/Signin'
|
||||
import Signup from './pages/Signup'
|
||||
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
|
||||
import { ToastContainer } from "react-toastify";
|
||||
import "react-toastify/dist/ReactToastify.css";
|
||||
import Navbar from "./components/Navbar";
|
||||
import Explore from "./pages/Explore";
|
||||
import Profile from "./pages/Profile";
|
||||
import ForgotPassword from "./pages/ForgotPassword";
|
||||
import Offers from "./pages/Offers";
|
||||
import Signin from "./pages/Signin";
|
||||
import Signup from "./pages/Signup";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<>
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route path='/' element={<Explore />}/>
|
||||
<Route path='/offers' element={<Offers />}/>
|
||||
<Route path='/profile' element={<Profile />}/>
|
||||
<Route path='/sign-in' element={<Signin />}/>
|
||||
<Route path='/sign-up' element={<Signup />}/>
|
||||
<Route path='/forgot-password' element={<ForgotPassword />}/>
|
||||
</Routes>
|
||||
<Navbar/>
|
||||
</Router>
|
||||
<Route path="/" element={<Explore />} />
|
||||
<Route path="/offers" element={<Offers />} />
|
||||
<Route path="/profile" element={<Profile />} />
|
||||
<Route path="/sign-in" element={<Signin />} />
|
||||
<Route path="/sign-up" element={<Signup />} />
|
||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||
</Routes>
|
||||
<Navbar />
|
||||
</Router>
|
||||
<ToastContainer />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
+11
-7
@@ -1,9 +1,13 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { getAuth } from "firebase/auth";
|
||||
|
||||
function Profile (){
|
||||
return (
|
||||
<>
|
||||
<h1>My app</h1>
|
||||
</>
|
||||
);
|
||||
function Profile() {
|
||||
const [user, setUser] = useState();
|
||||
const auth = getAuth();
|
||||
useEffect(() => {
|
||||
setUser(auth.currentUser);
|
||||
}, []);
|
||||
|
||||
return user ? <h1>{user.displayName}</h1> : "Not Logged In";
|
||||
}
|
||||
export default Profile
|
||||
export default Profile;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useState } from "react";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { toast } from "react-toastify";
|
||||
import { getAuth, signInWithEmailAndPassword } from "firebase/auth";
|
||||
import { ReactComponent as ArrowRightIcon } from "../assets/svg/keyboardArrowRightIcon.svg";
|
||||
import visibilityIcon from "../assets/svg/visibilityIcon.svg";
|
||||
import { getAuth, signInWithEmailAndPassword } from "firebase/auth";
|
||||
|
||||
function Signin() {
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
@@ -29,7 +30,7 @@ function Signin() {
|
||||
navigate("/");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
toast.error("Bad user credentials")
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'react-toastify/dist/ReactToastify.css';
|
||||
import { toast } from 'react-toastify';
|
||||
import { useState } from "react";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { ReactComponent as ArrowRightIcon } from "../assets/svg/keyboardArrowRightIcon.svg";
|
||||
@@ -47,7 +49,7 @@ function Signup() {
|
||||
|
||||
navigate("/");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
toast.error("something went wron with the registration")
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user