chore: fix shortcut space checks

This commit is contained in:
Steven 2024-02-06 21:15:58 +08:00
parent 4e73882bf1
commit 435fe04ab3

View File

@ -17,6 +17,7 @@ const ShortcutSpace = () => {
const currentUser = userStore.getCurrentUser();
const shortcutStore = useShortcutStore();
const [shortcut, setShortcut] = useState<Shortcut>();
const [loading, setLoading] = useState(true);
const [showCreateShortcutDrawer, setShowCreateShortcutDrawer] = useState(false);
useEffect(() => {
@ -28,9 +29,14 @@ const ShortcutSpace = () => {
console.error(error);
toast.error(error.details);
}
setLoading(false);
})();
}, [shortcutName]);
if (loading) {
return null;
}
if (!shortcut) {
if (!currentUser) {
navigateTo("/404");