forked from Navy.gif/webserver-framework-frontend
bs
This commit is contained in:
parent
dbd5a7a077
commit
d228597d0e
@ -5,12 +5,13 @@ import { useLoginContext } from "../structures/UserContext";
|
|||||||
const UserControls = () => {
|
const UserControls = () => {
|
||||||
|
|
||||||
const [user] = useLoginContext();
|
const [user] = useLoginContext();
|
||||||
console.log(user);
|
|
||||||
|
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
|
|
||||||
return <div className='user-controls'>
|
return <div className='user-controls'>
|
||||||
|
<div>
|
||||||
Hello {user.displayName}
|
Hello {user.displayName}
|
||||||
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -15,4 +15,4 @@ root.render(<React.StrictMode>
|
|||||||
// If you want to start measuring performance in your app, pass a function
|
// If you want to start measuring performance in your app, pass a function
|
||||||
// to log results (for example: reportWebVitals(console.log))
|
// to log results (for example: reportWebVitals(console.log))
|
||||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
// 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
11
src/pages/Admin.js
Normal 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
11
src/pages/Users.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const Users = () => {
|
||||||
|
|
||||||
|
return <div>
|
||||||
|
USERS
|
||||||
|
</div>;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Users;
|
9
src/structures/UnauthedRoute.js
Normal file
9
src/structures/UnauthedRoute.js
Normal 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;
|
||||||
|
};
|
Reference in New Issue
Block a user