Put an element in the website and remove it once the user logged in without refresh the website

Hi :wave:,

I put a box shows that must to login in order to complete the form and when the user logged in the box still appear until the user click refresh the website

The question is how can I remove the box element from the website without refreshing the website when the user logged in

Thank you for your advance :heart:

Corvid
check user logined or not, if user logined, you box will expand. Otherwise, this element remain default (collapased)

ONLY can do with corvid OR add it to the member’s page

You will need something like this…

import wixUsers from 'wix-users';

let user = wixUsers.currentUser;

let userId = user.id;      
let isLoggedIn = user.loggedIn

Put it into onReady-function when page has loaded you declare the variables.
Then you can make an if-query to check.

If isLoggedIn === true, or if isLoggedIn === false

if(..here the if-query.. ) {... here your code when is true ...}
else {...here your code if is false.....}

EXAMPLE_CODE…

if(isLoggedIn===true) {$w('#myELEMENT').expand()}
else {$w('#myELEMENT').collapse()}
1 Like