The Meteor docs for has2faEnabled say:
callback Function
Called with a boolean on success that indicates whether the user has or not 2FA enabled, or with a single
Error
argument on failure.
I tried it like this, with a single argument for the callback:
useEffect(() => {
Accounts.has2faEnabled((result) => {
debugger; // <== check callback argument here
if (result) {
setHasAlreadyEnabled2FA(true);
} else {
setHasAlreadyEnabled2FA(false);
}
})
}, []);
…and when there is no error, the result
argument comes back undefined – it does not report true or false.
I was expecting a boolean in the case of no error. What super-obvious thing am I missing?