Hello coders, newbie here!
I have a site that has, lets say two pages:
1 Welcome ( www.example.com/welcome )
2 Auth ( www.example.com/auth )
On the Welcome page, the user gets an option to select whether to Sign Up or Log In to the site. When the user chooses Sign Up , the mode is set to signup and if the user clicks on Log In the mode is set to login.
Now I want to pass this data to the Auth page via the URL for example: www.example.com/auth?mode=login
I know the simplest way to do this would be this:
var mode = login;
wixLocationFrontend.to("/auth?mode=" + mode);
And this is working well.
However I’d like to use the QueryParams add() to achieve the same.
var mode = login;
wixLocationFrontend.queryParams.add({
"mode": mode
});
And that’s working too… kinda. But here’s the catch. It adds the query parameters to the current page URL (www.example.com/welcome?mode=login) which is completely useless in this case.
So how do I use QueryParams add() along with wixLocationFrontend.to to achieve the following URL: www.example.com/auth?mode=login
(I’m sure there must be a very simple solution to this but me being a beginner can’t figure it out on my own!)
Thanks!
P.S. I’m not using wix-storage-frontend here because my website will have to communicate with external apps in the future so the only way to pass data from the would be through the URL using key - value pairs.