umami/pages/console/[[...id]].js

27 lines
604 B
JavaScript
Raw Normal View History

2020-09-27 09:51:29 +02:00
import React from 'react';
2020-08-07 11:27:12 +02:00
import Layout from 'components/layout/Layout';
import TestConsole from 'components/pages/TestConsole';
2020-09-27 09:51:29 +02:00
import useRequireLogin from 'hooks/useRequireLogin';
import useUser from 'hooks/useUser';
2020-07-24 04:56:55 +02:00
export default function ConsolePage({ enabled }) {
2020-09-27 09:51:29 +02:00
const { loading } = useRequireLogin();
const { user } = useUser();
if (loading || !enabled || !user?.is_admin) {
2020-09-27 09:51:29 +02:00
return null;
2020-09-18 22:40:46 +02:00
}
2020-07-24 04:56:55 +02:00
return (
2020-09-27 09:51:29 +02:00
<Layout>
<TestConsole />
2020-09-27 09:51:29 +02:00
</Layout>
2020-07-24 04:56:55 +02:00
);
}
export async function getServerSideProps() {
return {
props: { enabled: !!process.env.ENABLE_TEST_CONSOLE },
};
}