mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
Merge pull request #51 from PabloSzx/loading_share_page
share page loading
This commit is contained in:
commit
05dc77ca35
1 changed files with 8 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import NotFound from 'pages/404';
|
||||||
import { get } from 'lib/web';
|
import { get } from 'lib/web';
|
||||||
|
|
||||||
export default function SharePage() {
|
export default function SharePage() {
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
const [websiteId, setWebsiteId] = useState();
|
const [websiteId, setWebsiteId] = useState();
|
||||||
const [notFound, setNotFound] = useState(false);
|
const [notFound, setNotFound] = useState(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -23,10 +24,16 @@ export default function SharePage() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (id) {
|
if (id) {
|
||||||
loadData();
|
loadData().finally(() => {
|
||||||
|
setLoading(false);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}, [id]);
|
}, [id]);
|
||||||
|
|
||||||
|
if (loading) return null;
|
||||||
|
|
||||||
if (!id || notFound) {
|
if (!id || notFound) {
|
||||||
return <NotFound />;
|
return <NotFound />;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue