- I successfully built up customer log in and sign up page, but I try the code below, it won’t work, and it on works if I used wixLocation.to(‘/account/profile’ instead of
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
$w.onReady( function (){
$w(‘#submit’).onClick( function (){
let email = $w(‘#input3’).value;
let password = $w(‘#input4’).value;
wixUsers.register(email,password)
.then(()=>{ wixLocation.to(/memberprofile/${wixUsers.currentUser.id}
);
})
})
})
- My sense wix hasn’t updated the current user log in status at the same page, so I just wixLocation to account/profile. I set up a button, and on that page, I coded 2 ways :
export function buttonProfile_click(event) {
wixLocation.to(/memberprofile/${wixUsers.currentUser.id}
)
}
export function buttonProfile_click(event) {
//wixLocation.to(/memberprofile/${wixUsers.currentUser.id}
);
//wixLocation.to(‘/home’)
let userId = (wixUsers.currentUser.id);
console.log(userId);
console.log (“/memberprofile” + (userId) +“/”);
wixLocation.to(“/memberprofile/” + (userId) +“/”);
}
Unfortunately, neither of them works.