mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Updated login check method.
This commit is contained in:
parent
170b30b391
commit
796c65fa29
10 changed files with 45 additions and 40 deletions
|
|
@ -6,6 +6,7 @@ import PageHeader from 'components/layout/PageHeader';
|
|||
import WebsiteChartList from 'components/pages/WebsiteChartList';
|
||||
import DashboardSettingsButton from 'components/settings/DashboardSettingsButton';
|
||||
import useApi from 'hooks/useApi';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
import useDashboard from 'store/dashboard';
|
||||
import DashboardEdit from './DashboardEdit';
|
||||
import styles from './WebsiteList.module.css';
|
||||
|
|
@ -16,6 +17,7 @@ const messages = defineMessages({
|
|||
});
|
||||
|
||||
export default function Dashboard({ userId }) {
|
||||
const { user } = useRequireLogin();
|
||||
const dashboard = useDashboard();
|
||||
const { showCharts, limit, editing } = dashboard;
|
||||
const [max, setMax] = useState(limit);
|
||||
|
|
@ -27,7 +29,7 @@ export default function Dashboard({ userId }) {
|
|||
setMax(max + limit);
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
if (!user || isLoading) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import Layout from 'components/layout/Layout';
|
||||
import Menu from 'components/nav/Nav';
|
||||
import useUser from 'hooks/useUser';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
import styles from './Settings.module.css';
|
||||
|
||||
export default function Settings({ children }) {
|
||||
const user = useUser();
|
||||
const { user } = useRequireLogin();
|
||||
|
||||
if (!user) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue