Hi,
After trial and error, i patch up some code for it to works. Basically, after signing up or log in, member will be redirect to ‘blog’ page. The problem is that I don’t know about coding at all. The code below i put together from different people, whom their code itself didn’t work. And i just patch some line up together and it turn out work.
But i notice something. After the log in, the page wont redirect instantly. it will wait for about 1-1.5 full seconds before redirect. Which i think it’s weird. Usually, it should do instantly.
So, i guess, this code has some loop or some flaw. Can anyone who good at coding take a look and let me know which link should i change to make it better?
Thank you.
import wixLocation from ‘wix-location’;
import { authentication } from “wix-members-frontend”;
authentication.onLogin(async (member) => {
const loggedInMember = await member.getMember();
const memberId = loggedInMember._id;
console.log(Member ${memberId} logged in:
, loggedInMember);
wixLocation.to(“/blog”);
});