🐛 fix: Add the VITE_SHOW_LANDING_PAGE configuration to control the landing page display logic.

This commit is contained in:
web
2025-12-16 07:03:13 -08:00
parent 76481755ea
commit a8a3d18061
4 changed files with 22 additions and 1 deletions
+4
View File
@@ -9,6 +9,10 @@ VITE_CDN_URL=https://cdn.jsdmirror.com
# Enable tutorial document feature (true/false)
VITE_TUTORIAL_DOCUMENT=true
# Show landing page on home route (true/false, default: true)
# When set to false, users will be redirected to login page directly
VITE_SHOW_LANDING_PAGE=true
# Default login credentials (for development only)
VITE_USER_EMAIL=
VITE_USER_PASSWORD=
+10 -1
View File
@@ -10,11 +10,20 @@ export default function Main() {
const { user } = useGlobalStore();
const navigate = useNavigate();
const showLanding = import.meta.env.VITE_SHOW_LANDING_PAGE !== "false";
useEffect(() => {
if (user) {
navigate({ to: "/dashboard" });
return;
}
}, [user, navigate]);
if (!showLanding) {
navigate({ to: "/auth" });
}
}, [user, navigate, showLanding]);
if (!showLanding) return null;
return (
<main className="container space-y-16">