ReferenceError: UserErrors is not defined

Hi, trying to understand a few things:

  1. Getting the error in the title on line 20. Here is the code:


and the error:

  1. Why is the code running twice?

  2. Why do we need {} on the import for currentMember and not for wixWindow?

Thank you!

Re 1 and 2 - I don’t know. Is it on your live site?
As for 3 - it’s because wixWindow is defined as ‘default’ in ‘wix-window’ while currentMemeber is not (therefore you have to put it in curly brackets).

On the live site, this ReferenceError isn’t reported. Instead it says “No user logged in”
I’m trying to run this code after the user logs in, however logging in doesn’t cause a reload of the home page so the code is not run.

I learned about authentication.onLogin(), so I moved the code to the Global Site page in EditorX and now it is running correctly, and not running twice.

:+1: Yes, that’s what you should do.