diff options
Diffstat (limited to 'communities/red-right-hand/174bg.net/src/app/login/page.js')
| -rw-r--r-- | communities/red-right-hand/174bg.net/src/app/login/page.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/communities/red-right-hand/174bg.net/src/app/login/page.js b/communities/red-right-hand/174bg.net/src/app/login/page.js deleted file mode 100644 index b2b1ea8..0000000 --- a/communities/red-right-hand/174bg.net/src/app/login/page.js +++ /dev/null @@ -1,51 +0,0 @@ -"use client"; - -import { Suspense, useEffect, useState } from "react"; -import { useSearchParams } from "next/navigation"; -import { authClient } from "@/lib/auth-client"; - -function LoginRedirect() { - const searchParams = useSearchParams(); - const callbackUrl = searchParams.get("callbackUrl") ?? "/secure"; - const [error, setError] = useState(null); - - const signIn = () => { - authClient.signIn - .social({ - provider: "discord", - callbackURL: callbackUrl, - }) - .then(({ error }) => { - if (error) setError(error.message ?? "Sign-in failed"); - }); - }; - - useEffect(() => { - signIn(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - if (error) { - return ( - <div> - <p>Error: {error}</p> - <button onClick={signIn}>Retry</button> - </div> - ); - } - - return ( - <div> - <p>Redirecting to Discord...</p> - <button onClick={signIn}>Click here if nothing happens</button> - </div> - ); -} - -export default function LoginPage() { - return ( - <Suspense fallback={<p>Loading...</p>}> - <LoginRedirect /> - </Suspense> - ); -} |
