Get updated framework #1

Merged
D3vision merged 13 commits from Navy.gif/webserver-framework-frontend:master into master 2022-11-23 14:14:02 +01:00
5 changed files with 35 additions and 3 deletions
Showing only changes of commit d228597d0e - Show all commits

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'>
Hello {user.displayName}
<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;
};