Improve auth flows
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user