Skip to content

Commit 3e49fcc

Browse files
committed
docs(function): propagate unenrollMfa boolean in example snippets
Address Copilot review on 979a5b0: `Client.unenrollMfa()` returns `Promise<boolean>`, but both new examples discarded the result and returned `{ success: true }` unconditionally. That breaks the convention established by `deleteUser` / `sendPasswordResetEmail` elsewhere in this guide and would mask a false return from the API. - Single-factor example now captures and returns the boolean (`const success = await idpClient.unenrollMfa(...); return { success }`). - Reset-all example collects the per-factor booleans via `Promise.all` and aggregates with `results.every(Boolean)`.
1 parent 979a5b0 commit 3e49fcc

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

docs/guides/function/managing-idp-users.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,11 @@ To remove one specific factor:
346346
```js
347347
export default async (args) => {
348348
const idpClient = new tailor.idp.Client({ namespace: args.namespaceName });
349-
await idpClient.unenrollMfa({ userId: args.userId, mfaFactorId: args.mfaFactorId });
350-
return { success: true };
349+
const success = await idpClient.unenrollMfa({
350+
userId: args.userId,
351+
mfaFactorId: args.mfaFactorId,
352+
});
353+
return { success };
351354
};
352355
```
353356

@@ -362,13 +365,13 @@ export default async (args) => {
362365
return { success: false, reason: "User has no enrolled MFA factors" };
363366
}
364367

365-
await Promise.all(
368+
const results = await Promise.all(
366369
user.mfaFactorIds.map((mfaFactorId) =>
367370
idpClient.unenrollMfa({ userId: user.id, mfaFactorId }),
368371
),
369372
);
370373

371-
return { success: true };
374+
return { success: results.every(Boolean) };
372375
};
373376
```
374377

0 commit comments

Comments
 (0)