This commit is contained in:
qt-coder 2021-06-22 08:19:52 +08:00
parent df436e9832
commit 8d750fd31c
2 changed files with 37 additions and 26 deletions

View file

@ -8,6 +8,7 @@ import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
import Link from 'next/link'
import AuthButton from './AuthButton'
import { useSession } from 'next-auth/client'
const useStyles = makeStyles((theme) => ({
root: {
@ -22,6 +23,7 @@ const useStyles = makeStyles((theme) => ({
}));
export default function ButtonAppBar() {
const [session, loading] = useSession()
const classes = useStyles();
return (
@ -38,9 +40,9 @@ export default function ButtonAppBar() {
Cath.exe
</Link>
</Typography>
<Button color="inherit">Stats</Button>
{session && <Button color="inherit">Stats</Button>}
<AuthButton/>
<Link href='/controlpanel'><Button color="inherit">Control Panel</Button></Link>
{session && <Link href='/controlpanel'><Button color="inherit">Control Panel</Button></Link>}
</Toolbar>
</AppBar>
</div>

View file

@ -8,6 +8,7 @@ import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import Paper from '@material-ui/core/Paper';
import Head from 'next/head'
import { useSession } from 'next-auth/client'
const useStyles = makeStyles({
table: {
@ -27,9 +28,12 @@ const rows = [
];
function Commands() {
const [session, loading] = useSession()
const classes = useStyles();
return (
<>
{session &&
<>
<Head>
<title>Cath Commands</title>
@ -57,6 +61,11 @@ function Commands() {
</Table>
</TableContainer>
</>
} {!session && <>
<h1>Seems like you&apos;re not logged in. Log in to get started!</h1>
</>
}
</>
);
}