There should not be a semicolon before ‘.then’.
Such errors can be detected using the developer console in Preview Mode, or in the console of your browser’s devtools .
Also, if you use console.log method inside your code, then whatever you log will appear in the console:
console.log(result); // logs the value of the result variable
This is useful for debugging purposes.
Note: The APIs in wix-users are only partially functional when previewing your site. View a published version of your site to see their complete functionality.