Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add redirectTo to GoogleButton

Steven Teyd37c34f0763e
diff --git a/apps/web/ui/auth/login/google-button.tsx b/apps/web/ui/auth/login/google-button.tsx
index 108eba1b1c..8b064c525b 100644
--- a/apps/web/ui/auth/login/google-button.tsx
+++ b/apps/web/ui/auth/login/google-button.tsx
@@ -5,7 +5,7 @@ import { useSearchParams } from "next/navigation";
import { useContext } from "react";
import { LoginFormContext } from "./login-form";
-export function GoogleButton() {
+export function GoogleButton({ redirectTo }: { redirectTo?: string }) {
const searchParams = useSearchParams();
const next = searchParams?.get("next");
@@ -21,6 +21,7 @@ export function GoogleButton() {
setLastUsedAuthMethod("google");
signIn("google", {
...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ ...(redirectTo && redirectTo.length > 0 ? { redirectTo } : {}),
});
}}
loading={clickedMethod === "google"}
diff --git a/apps/web/ui/auth/login/login-form.tsx b/apps/web/ui/auth/login/login-form.tsx
index cd215a33fa..696ed5d145 100644
--- a/apps/web/ui/auth/login/login-form.tsx
+++ b/apps/web/ui/auth/login/login-form.tsx
@@ -112,6 +112,7 @@ export default function LoginForm({
{
method: "google",
component: GoogleButton,
+ props: { redirectTo },
},
{
method: "github",