mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
fixed issue with login page.
This commit is contained in:
1 parent
11fc5c8b3d
commit
84f010cb87
6 files changed
+153
-30
No files matched your search
@@ -14,14 +14,9 @@ export default function Login() {
|
||||
const { data: session, status } = useSession();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
// Redirect if already authenticated
|
||||
useEffect(() => {
|
||||
if (status === "authenticated") {
|
||||
const callbackUrl = searchParams.get("callbackUrl") || "/team-selection";
|
||||
router.push(callbackUrl);
|
||||
}
|
||||
|
||||
// Check for error param
|
||||
// Removed redirection for authenticated users; do not auto-navigate away from login.
|
||||
// Retain error handling from search params.
|
||||
const errorParam = searchParams.get("error");
|
||||
if (errorParam) {
|
||||
if (errorParam === "AuthError") {
|
||||
@@ -30,7 +25,7 @@ export default function Login() {
|
||||
setError("Authentication failed. Please try again.");
|
||||
}
|
||||
}
|
||||
}, [status, router, searchParams]);
|
||||
}, [searchParams]);
|
||||
|
||||
const handleLogin = async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
Reference in new issue
Block a user