diff --git a/components/layout/Layout.js b/components/layout/AppLayout.js
similarity index 73%
rename from components/layout/Layout.js
rename to components/layout/AppLayout.js
index f1c31bb0..7c59b007 100644
--- a/components/layout/Layout.js
+++ b/components/layout/AppLayout.js
@@ -3,8 +3,10 @@ import Head from 'next/head';
import Header from 'components/layout/Header';
import Footer from 'components/layout/Footer';
import useLocale from 'hooks/useLocale';
+import useRequireLogin from 'hooks/useRequireLogin';
-export default function Layout({ title, children, header = true, footer = true }) {
+export default function AppLayout({ title, children }) {
+ useRequireLogin();
const { dir } = useLocale();
return (
@@ -12,9 +14,9 @@ export default function Layout({ title, children, header = true, footer = true }
{title ? `${title} | umami` : 'umami'}
- {header && }
+
{children}
- {footer && }
+
);
}
diff --git a/components/layout/Layout.module.css b/components/layout/AppLayout.module.css
similarity index 100%
rename from components/layout/Layout.module.css
rename to components/layout/AppLayout.module.css
diff --git a/components/pages/dashboard/Dashboard.js b/components/pages/dashboard/Dashboard.js
index 660e0c10..f67219db 100644
--- a/components/pages/dashboard/Dashboard.js
+++ b/components/pages/dashboard/Dashboard.js
@@ -5,11 +5,11 @@ import Page from 'components/layout/Page';
import PageHeader from 'components/layout/PageHeader';
import WebsiteChartList from 'components/pages/websites/WebsiteChartList';
import DashboardSettingsButton from 'components/settings/DashboardSettingsButton';
+import DashboardEdit from 'components/pages/dashboard/DashboardEdit';
+import styles from 'components/pages/websites/WebsiteList.module.css';
+import useUser from 'hooks/useUser';
import useApi from 'hooks/useApi';
-import useRequireLogin from 'hooks/useRequireLogin';
import useDashboard from 'store/dashboard';
-import DashboardEdit from './DashboardEdit';
-import styles from '../websites/WebsiteList.module.css';
const messages = defineMessages({
dashboard: { id: 'label.dashboard', defaultMessage: 'Dashboard' },
@@ -17,7 +17,7 @@ const messages = defineMessages({
});
export default function Dashboard({ userId }) {
- const { user } = useRequireLogin();
+ const { user } = useUser();
const dashboard = useDashboard();
const { showCharts, limit, editing } = dashboard;
const [max, setMax] = useState(limit);
diff --git a/components/pages/login/LoginForm.js b/components/pages/login/LoginForm.js
index a05f87e8..1c78cb5b 100644
--- a/components/pages/login/LoginForm.js
+++ b/components/pages/login/LoginForm.js
@@ -14,6 +14,7 @@ import useApi from 'hooks/useApi';
import { setUser } from 'store/app';
import { setClientAuthToken } from 'lib/client';
import Logo from 'assets/logo.svg';
+import styles from './LoginForm.module.css';
export default function LoginForm() {
const router = useRouter();
@@ -26,20 +27,18 @@ export default function LoginForm() {
setClientAuthToken(token);
setUser(user);
- await router.push('/websites');
+ await router.push('/dashboard');
},
});
};
return (
- <>
-
-