mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Fixed issue with accessing user dashboards. Closes #1590
This commit is contained in:
parent
46a18f2918
commit
8b64ef1a4e
8 changed files with 33 additions and 25 deletions
|
|
@ -2,17 +2,27 @@ import React from 'react';
|
|||
import Layout from 'components/layout/Layout';
|
||||
import Dashboard from 'components/pages/Dashboard';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
import { useRouter } from 'next/router';
|
||||
import useUser from 'hooks/useUser';
|
||||
|
||||
export default function DashboardPage() {
|
||||
const {
|
||||
query: { id },
|
||||
isReady,
|
||||
asPath,
|
||||
} = useRouter();
|
||||
const { loading } = useRequireLogin();
|
||||
const user = useUser();
|
||||
|
||||
if (loading) {
|
||||
if (!user || !isReady || loading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const userId = id?.[0];
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Dashboard />
|
||||
<Dashboard key={asPath} userId={user.id || userId} />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue