Skip to content

Commit

Permalink
add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
moe-dev committed Feb 13, 2025
1 parent 10472cb commit a8bd73b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-moles-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@turnkey/sdk-react": patch
---

Fix issue with EWK where suborgs were being created on failed fetches
10 changes: 5 additions & 5 deletions packages/sdk-react/src/components/auth/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const Auth: React.FC<AuthProps> = ({
!getVerifiedSuborgsResponse.organizationIds
) {
onError(authErrors.suborg.fetchFailed);
return;
return null;
}
suborgId = getVerifiedSuborgsResponse?.organizationIds[0];
} else {
Expand All @@ -152,7 +152,7 @@ const Auth: React.FC<AuthProps> = ({
});
if (!getSuborgsResponse || !getSuborgsResponse.organizationIds) {
onError(authErrors.suborg.fetchFailed);
return;
return null;
}
suborgId = getSuborgsResponse?.organizationIds[0];
}
Expand Down Expand Up @@ -265,14 +265,14 @@ const Auth: React.FC<AuthProps> = ({
) => {
const suborgId = await handleGetOrCreateSuborg(type, value);
const initAuthResponse = await server.sendOtp({
suborgID: suborgId,
suborgID: suborgId!,
otpType,
contact: value,
...(customSmsMessage && { customSmsMessage }),
userIdentifier: authIframeClient?.iframePublicKey!,
});
if (initAuthResponse && initAuthResponse.otpId) {
setSuborgId(suborgId);
setSuborgId(suborgId!);
setOtpId(initAuthResponse?.otpId!);
setStep(otpType);
} else {
Expand All @@ -290,7 +290,7 @@ const Auth: React.FC<AuthProps> = ({
},
);
const oauthResponse = await server.oauth({
suborgID: suborgId,
suborgID: suborgId!,
oidcToken: credential,
targetPublicKey: authIframeClient?.iframePublicKey!,
sessionLengthSeconds: authConfig.sessionLengthSeconds,
Expand Down

0 comments on commit a8bd73b

Please sign in to comment.