Error: Parsing error: Unexpected token } (13:2)

Hi,
I added code to my site and it looks fine, but I get a parsing error. I’ve tried everything, including rewriting the code step by step, but still can’t get the error to go away.
Here is my code.

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';


$w.onReady(function(){
	$s('#loginNow').onClick(function (){
		let email = $w('#loginEmail').value;
		let password = $w('loginPassword').value;
		wixUsers.login(email,password)
		.then(()=>{
			wixLocation.to('/blog');
		}
	})
})

Hi, user3790 !!

Please add the “#” that is missing and modify the code to look like this. :raised_hands:

let password = $w("#loginPassword").value;

Ah, also, the “w” is missing, so please add the “w” and modify the code to look like this. :raised_hands:

$w("#loginNow").onClick(function(){

});

Also, if possible, I recommend replacing wix-users and wix-location with the latest APIs. The APIs you’re using will still work, but they’re likely deprecated and are no longer being maintained. Please refer to the links below for guidance. :wink: :+1:

https://dev.wix.com/docs/velo/api-reference/wix-members-frontend/authentication/login
https://dev.wix.com/docs/velo/api-reference/wix-location-frontend/to

1 Like