mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Refactor env check.
This commit is contained in:
parent
ba63991a92
commit
fc9584eb44
14 changed files with 30 additions and 76 deletions
|
|
@ -4,11 +4,11 @@ import TestConsole from 'components/pages/TestConsole';
|
|||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
import useUser from 'hooks/useUser';
|
||||
|
||||
export default function ConsolePage({ enabled, pageDisabled }) {
|
||||
export default function ConsolePage({ pageDisabled }) {
|
||||
const { loading } = useRequireLogin();
|
||||
const { user } = useUser();
|
||||
|
||||
if (pageDisabled || loading || !enabled || !user?.isAdmin) {
|
||||
if (pageDisabled || loading || !user?.isAdmin) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -22,8 +22,7 @@ export default function ConsolePage({ enabled, pageDisabled }) {
|
|||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI,
|
||||
enabled: !!process.env.ENABLE_TEST_CONSOLE,
|
||||
pageDisabled: !process.env.ENABLE_TEST_CONSOLE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue