import React from 'react'; import Link from 'next/link'; import cookies from 'next-cookies'; import Layout from 'components/Layout'; import { verifySecureToken } from 'lib/crypto'; export default function HomePage({ username }) { return (

You've successfully logged in as {username}.

Logout 🡒
); } export async function getServerSideProps(context) { const token = cookies(context)['umami.auth']; try { const payload = await verifySecureToken(token); return { props: { username: payload.username, }, }; } catch { const { res } = context; res.statusCode = 303; res.setHeader('Location', '/login'); res.end(); } return { props: {} }; }