import React from 'react'; import Link from 'next/link'; import { parse } from 'cookie'; import Layout from 'components/Layout'; import PageviewsChart from 'components/PageviewsChart'; import { verifySecureToken } from 'lib/crypto'; import { subDays, endOfDay } from 'date-fns'; import WebsiteList from '../components/WebsiteList'; export default function HomePage({ username }) { return (
Logout 🡒
); } export async function getServerSideProps({ req, res }) { const token = parse(req.headers.cookie || '')['umami.auth']; try { const payload = await verifySecureToken(token); return { props: { ...payload, }, }; } catch { res.statusCode = 303; res.setHeader('Location', '/login'); res.end(); } return { props: {} }; }