Skip to content

Commit

Permalink
Merge pull request umami-software#51 from PabloSzx/loading_share_page
Browse files Browse the repository at this point in the history
share page loading
  • Loading branch information
mikecao authored Aug 22, 2020
2 parents 8d27a0a + 0787818 commit 05dc77c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pages/share/[...id].js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import NotFound from 'pages/404';
import { get } from 'lib/web';

export default function SharePage() {
const [loading, setLoading] = useState(true);
const [websiteId, setWebsiteId] = useState();
const [notFound, setNotFound] = useState(false);
const router = useRouter();
Expand All @@ -23,10 +24,16 @@ export default function SharePage() {

useEffect(() => {
if (id) {
loadData();
loadData().finally(() => {
setLoading(false);
});
} else {
setLoading(false);
}
}, [id]);

if (loading) return null;

if (!id || notFound) {
return <NotFound />;
}
Expand Down

0 comments on commit 05dc77c

Please sign in to comment.