This commit is contained in:
Erik 2022-11-20 18:40:25 +02:00
parent dbd5a7a077
commit d228597d0e
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
5 changed files with 35 additions and 3 deletions

View File

@ -5,12 +5,13 @@ import { useLoginContext } from "../structures/UserContext";
const UserControls = () => {
const [user] = useLoginContext();
console.log(user);
if (!user) return;
return <div className='user-controls'>
<div>
Hello {user.displayName}
</div>
</div>;
};

View File

@ -15,4 +15,4 @@ root.render(<React.StrictMode>
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals(console.log);
// reportWebVitals(console.log);

11
src/pages/Admin.js Normal file
View File

@ -0,0 +1,11 @@
import React from "react";
const Admin = () => {
return <div>
ADMIN
</div>;
};
export default Admin;

11
src/pages/Users.js Normal file
View File

@ -0,0 +1,11 @@
import React from "react";
const Users = () => {
return <div>
USERS
</div>;
};
export default Users;

View File

@ -0,0 +1,9 @@
import React from 'react';
import { Navigate } from "react-router-dom";
import { getUser } from "../util/Util";
export const UnauthedRoute = ({ children }) => {
const user = getUser();
if (user) return <Navigate to='/home' replace />;
return children;
};