Skip to content

Commit

Permalink
docs: fix existing examples
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Nov 1, 2024
1 parent f0c59a8 commit c305124
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const LinkingPage: React.FC = () => {
{ id: "email", value: userInfo.user.emails[0] },
{ id: "password", value: password },
],
shouldTryLinkingWithSessionUser: true,
});

if (resp.status !== "OK") {
Expand All @@ -54,6 +55,7 @@ export const LinkingPage: React.FC = () => {
try {
let response = await Passwordless.createCode({
phoneNumber,
shouldTryLinkingWithSessionUser: true,
});

if (cancel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function SelectPhone() {
<li
className="phoneNumberCard"
onClick={() => {
Passwordless.createCode({ phoneNumber: number })
Passwordless.createCode({ phoneNumber: number, shouldTryLinkingWithSessionUser: true })
.then(async (info) => {
if (info.status !== "OK") {
setError(info.reason);
Expand Down
4 changes: 2 additions & 2 deletions examples/with-multiple-email-sign-in/api-server/epOverride.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function epOverride(oI: APIInterface): APIInterface {
signInPOST: async function (input) {
const emailField = input.formFields.find((f) => f.id === "email")!;

let primaryEmail = getPrimaryEmailFromInputEmail(emailField.value);
let primaryEmail = getPrimaryEmailFromInputEmail(emailField.value as string);
if (primaryEmail !== undefined) {
emailField.value = primaryEmail;
}
Expand All @@ -16,7 +16,7 @@ export function epOverride(oI: APIInterface): APIInterface {
signUpPOST: async function (input) {
const emailField = input.formFields.find((f) => f.id === "email")!;

let primaryEmail = getPrimaryEmailFromInputEmail(emailField.value);
let primaryEmail = getPrimaryEmailFromInputEmail(emailField.value as string);
if (primaryEmail !== undefined) {
emailField.value = primaryEmail;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/with-phone-password-mfa/api-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ supertokens.init({
// We format the phone number here to get it to a standard format
const emailField = input.formFields.find((field) => field.id === "email");
if (emailField) {
const phoneNumber = parsePhoneNumber(emailField.value);
const phoneNumber = parsePhoneNumber(emailField.value as string);
if (phoneNumber !== undefined && phoneNumber.isValid()) {
emailField.value = phoneNumber.number;
}
Expand All @@ -93,7 +93,7 @@ supertokens.init({
// We format the phone number here to get it to a standard format
const emailField = input.formFields.find((field) => field.id === "email");
if (emailField) {
const phoneNumber = parsePhoneNumber(emailField.value);
const phoneNumber = parsePhoneNumber(emailField.value as string);
if (phoneNumber !== undefined && phoneNumber.isValid()) {
emailField.value = phoneNumber.number;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/with-phone-password/api-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ supertokens.init({
// We format the phone number here to get it to a standard format
const emailField = input.formFields.find((field) => field.id === "email");
if (emailField) {
const phoneNumber = parsePhoneNumber(emailField.value);
const phoneNumber = parsePhoneNumber(emailField.value as string);
if (phoneNumber !== undefined && phoneNumber.isValid()) {
emailField.value = phoneNumber.number;
}
Expand All @@ -91,7 +91,7 @@ supertokens.init({
// We format the phone number here to get it to a standard format
const emailField = input.formFields.find((field) => field.id === "email");
if (emailField) {
const phoneNumber = parsePhoneNumber(emailField.value);
const phoneNumber = parsePhoneNumber(emailField.value as string);
if (phoneNumber !== undefined && phoneNumber.isValid()) {
emailField.value = phoneNumber.number;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const CustomSignInUpTheme = (props: AuthPageThemeProps) => {

const res = await Passwordless.createCode({
phoneNumber,
tryLinkingWithSessionUser: true,
userContext: { additionalAttemptInfo },
});

Expand Down

0 comments on commit c305124

Please sign in to comment.