mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Implement redux.
This commit is contained in:
parent
9d8a2406e1
commit
5d4ff5cfa4
31 changed files with 341 additions and 85 deletions
|
|
@ -1,33 +1,18 @@
|
|||
import React from 'react';
|
||||
import { parse } from 'cookie';
|
||||
import Layout from 'components/Layout';
|
||||
import { verifySecureToken } from 'lib/crypto';
|
||||
import WebsiteList from '../components/WebsiteList';
|
||||
import WebsiteList from 'components/WebsiteList';
|
||||
import useUser from 'hooks/useUser';
|
||||
|
||||
export default function HomePage() {
|
||||
const { loading } = useUser();
|
||||
|
||||
if (loading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function HomePage({ username }) {
|
||||
return (
|
||||
<Layout>
|
||||
<WebsiteList />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
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: {} };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue