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 [user] = useLoginContext();
|
||||
console.log(user);
|
||||
|
||||
if (!user) return;
|
||||
|
||||
return <div className='user-controls'>
|
||||
Hello {user.displayName}
|
||||
<div>
|
||||
Hello {user.displayName}
|
||||
</div>
|
||||
</div>;
|
||||
|
||||
};
|
||||
|
@ -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
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