Skip to content

Commit

Permalink
change page title
Browse files Browse the repository at this point in the history
  • Loading branch information
shathakh committed Oct 1, 2022
1 parent f4002d0 commit 1a2f1c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions client/src/components/Pages/users/SignIn.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ const loginValidationSchema = yup
.required();

function SignIn() {
const [isLogged, setIsLogged] = useOutletContext();

const [title, setPageName, user, setUser, isLogged, setIsLogged] =
useOutletContext();
setPageName('Log In');
const navigate = useNavigate();
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
Expand Down
20 changes: 11 additions & 9 deletions client/src/root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useEffect, useState } from 'react';
function Root() {
const [title, setTitle] = useState('');
const [pageName, setPageName] = useState('');
// const [isLogged, setIsLogged] = useState(false);
const [isLogged, setIsLogged] = useState(false);
const [user, setUser] = useState({ token: false });

useEffect(() => {
Expand All @@ -28,20 +28,22 @@ function Root() {
});
}, []);

// useEffect(() => {
// localStorage.getItem('logged');
// setIsLogged(localStorage.getItem('logged'));
// }, []);
// useEffect(() => {
// localStorage.setItem('logged', isLogged);
// }, [isLogged]);
useEffect(() => {
localStorage.getItem('logged');
setIsLogged(localStorage.getItem('logged'));
}, []);
useEffect(() => {
localStorage.setItem('logged', isLogged);
}, [isLogged]);
return (
<>
<ToastContainer />
<Header />
<SecondHeader title={title} setTitle={setTitle} />
<PageTitle pageName={pageName} />
<Outlet context={[title, setPageName, user, setUser]} />
<Outlet
context={[title, setPageName, user, setUser, isLogged, setIsLogged]}
/>

<Footer />
</>
Expand Down

0 comments on commit 1a2f1c6

Please sign in to comment.