Improve auth flows

This commit is contained in:
augmentedpotato
2026-04-02 09:06:24 -06:00
parent 3ee59521fd
commit a76895434d
6 changed files with 300 additions and 39 deletions

View File

@@ -226,10 +226,11 @@ function AppointmentsPage() {
useEffect(() => {
if (!authLoading && !user) {
router.push("/login");
const target = preselectedPetId ? `/appointments?petId=${encodeURIComponent(preselectedPetId)}` : "/appointments";
router.push(`/login?next=${encodeURIComponent(target)}`);
}
}, [authLoading, user, router]);
}, [authLoading, user, router, preselectedPetId]);
useEffect(() => {
if (!token) {