diff --git a/apps/readest-app/src/app/auth/page.tsx b/apps/readest-app/src/app/auth/page.tsx index 671d6703..befa5de3 100644 --- a/apps/readest-app/src/app/auth/page.tsx +++ b/apps/readest-app/src/app/auth/page.tsx @@ -231,7 +231,12 @@ export default function AuthPage() { settings.keepLogin = false; setSettings(settings); saveSettings(envConfig, settings); - router.back(); + const redirectTo = new URLSearchParams(window.location.search).get('redirect'); + if (redirectTo) { + router.push(redirectTo); + } else { + router.back(); + } }; const getAuthLocalization = () => { diff --git a/apps/readest-app/src/app/user/layout.tsx b/apps/readest-app/src/app/user/layout.tsx new file mode 100644 index 00000000..472c4cd1 --- /dev/null +++ b/apps/readest-app/src/app/user/layout.tsx @@ -0,0 +1,10 @@ +import { Metadata } from 'next'; + +export const metadata: Metadata = { + title: 'User Account', + description: 'Manage your account settings and subscription', +}; + +export default function ProfileLayout({ children }: { children: React.ReactNode }) { + return <>{children}; +} diff --git a/apps/readest-app/src/app/user/page.tsx b/apps/readest-app/src/app/user/page.tsx index 1a11f5ec..35ed24f9 100644 --- a/apps/readest-app/src/app/user/page.tsx +++ b/apps/readest-app/src/app/user/page.tsx @@ -67,6 +67,19 @@ const ProfilePage = () => { const [mounted, setMounted] = useState(false); useEffect(() => setMounted(true), []); + useEffect(() => { + if (!mounted) return; + + const isAuthenticated = user && token && appService; + if (isAuthenticated) return; + + const timer = setTimeout(() => { + router.push('/auth?redirect=/library'); + }, 1000); + + return () => clearTimeout(timer); + }, [mounted, user, token, appService, router]); + useTheme({ systemUIVisible: false }); const { quotas, userProfilePlan = 'free' } = useQuotaStats();