🐛 fix: Add the VITE_SHOW_LANDING_PAGE configuration to control the landing page display logic.
This commit is contained in:
@@ -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,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">
|
||||
|
||||
Reference in New Issue
Block a user