Once a member has logged in, go to a default page.

Hi,
Thanks for taking the time to read my post.

I have set up a member area on my website and it’s all working but what I would like, is once my members log in is successful, it sends them to a default page.

Example:

I click log in, it is successful and it automatically takes me to “My Account”.

I’ve tried some codes that were posted a while ago but I keep getting errors. I’m brand new to Velo, so if someone could help me out I’d greatly appreciate it.

How to achieve your wished functionality?

  1. Your code must recognice when a member has logged-in…
import { authentication } from 'wix-members';

authentication.onLogin((memberInfo) => {
  const memberId = memberInfo.id; console.log(memberId);
  console.log('Member logged in');
});
  1. Your code also has to be able to do a redirection to another page…
import wixLocation from 'wix-location';

const options = {
  disableScrollToTop: true
};

wixLocation.to("/about-me", options);

Combine the 2 provided codes to make your wished functionality come true.

2 Likes

@russian-dima thank you so much!