From 53cca9581d800b39b013266b079f115a565d2cc0 Mon Sep 17 00:00:00 2001 From: qt-coder Date: Tue, 22 Jun 2021 08:22:10 +0800 Subject: [PATCH] Protected control panel --- pages/controlpanel/index.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/pages/controlpanel/index.js b/pages/controlpanel/index.js index 307c3ef..1de3a7f 100644 --- a/pages/controlpanel/index.js +++ b/pages/controlpanel/index.js @@ -1,17 +1,28 @@ import React from 'react' import CardContainer from '../../components/CardContainer' import Head from 'next/head' +import { useSession } from 'next-auth/client' function index() { + + const [session, loading] = useSession() + return ( <> - - Cath Control Panel - -
-

Control Panel

- Commands -
+ {!session && <> +

Seems like you're not logged in. Log in to get started!

+ + } + {session && <> + + Cath Control Panel + +
+

Control Panel

+ Commands +
+ + } ) }