Add ssoLoginURL in activate account outputs

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-12 16:04:14 +04:00
parent 03bdb27e20
commit 1d54f22cd9
7 changed files with 128 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<852ecee082c322aba273f04575353fbd>>
* @generated SignedSource<<e2bdaf924ff82d11f3c2ef4a8353c8e8>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -18,6 +18,7 @@ export type ActivateAccountPageMutation$variables = {
export type ActivateAccountPageMutation$data = {
readonly activateAccount: {
readonly createPasswordToken: string | null | undefined;
readonly ssoLoginUrl: string | null | undefined;
} | null | undefined;
};
export type ActivateAccountPageMutation = {
@@ -54,6 +55,13 @@ v1 = [
"kind": "ScalarField",
"name": "createPasswordToken",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "ssoLoginUrl",
"storageKey": null
}
],
"storageKey": null
@@ -77,16 +85,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "388c90522ecf3a3365e171a623fb2d2e",
"cacheID": "ab62d7332fce4af79b46c8627e551370",
"id": null,
"metadata": {},
"name": "ActivateAccountPageMutation",
"operationKind": "mutation",
"text": "mutation ActivateAccountPageMutation(\n $input: ActivateAccountInput!\n) {\n activateAccount(input: $input) {\n createPasswordToken\n }\n}\n"
"text": "mutation ActivateAccountPageMutation(\n $input: ActivateAccountInput!\n) {\n activateAccount(input: $input) {\n createPasswordToken\n ssoLoginUrl\n }\n}\n"
}
};
})();
(node as any).hash = "c27b723383934423bf92926820426653";
(node as any).hash = "fd91da524bb46256a9d8e1ae31590dc2";
export default node;

View File

@@ -16,6 +16,7 @@ const activateAccountMutation = graphql`
) {
activateAccount(input: $input) {
createPasswordToken
ssoLoginUrl
}
}
`;
@@ -73,6 +74,14 @@ export default function ActivateAccountPage() {
throw new Error("mutation data missing");
}
if (activateAccount.ssoLoginUrl) {
const url = new URL(activateAccount.ssoLoginUrl);
url.search = searchParams.toString();
window.location.href = url.toString();
return;
}
if (activateAccount.createPasswordToken) {
const search = new URLSearchParams([
["token", activateAccount.createPasswordToken],
@@ -85,12 +94,14 @@ export default function ActivateAccountPage() {
},
{ replace: true },
);
} else {
void navigate({
pathname: safeContinueUrl.pathname,
search: safeContinueUrl.search,
}, { replace: true });
return;
}
const search = new URLSearchParams([["continue", safeContinueUrl.toString()]]);
void navigate({
pathname: "/auth/password-login",
search: "?" + search.toString(),
}, { replace: true });
},
onError: (e) => {
toast({
@@ -100,7 +111,7 @@ export default function ActivateAccountPage() {
});
},
});
}, [__, toast, activateAccount, navigate, safeContinueUrl]);
}, [__, toast, activateAccount, navigate, safeContinueUrl, searchParams]);
useEffect(() => {
const token = searchParams.get("token");