Wixlocation.to

Hi im tryind to redirect to login user to a dynamic page but im not having sucess

my code is

export function profileButton_click(event, $w) {
wixLocation.to (/database-trade/Update/${ [wixUsers.currentUser.id](http://wixusers.currentuser.id/) });
}

MY DYNAMIC PAGE URL IS
/database_trade/Update/{[ID]}

the user must be logged in to acess an especific member page

but the query are searching for the wrong ID
and the connection is not doing correctely
MEMBER LOGIN > DYNAMIC PAGE

Can you help me ?

Hi,
Can you please share a link to your site so we can inspect ?
Roi

HI Roi
Www.lupeweb.com

Hi,
I’ve signed up to your site and the profile button navigates me to the update dynamic page.
Did i miss some ?
Roi

THats the problem
What appears in the dynamic page?

Only your email correct ?

When IS a email that is already in the database
Is not apeaaring the other information to update

It apreses only the email
It sends to a wrong database Id

The query of the code are sending to a wrong database Id

Roi
I think i found the problem

.then( (results) => {
// if an item for the user is not found
if (results.items.length === 0) {
// create an item
const toInsert = {
“_id”: userId,
“email”: userEmail
};
// add the item to the collection
wixData.insert(“database_trade”, toInsert)
.catch( (err) => {
console.log(err);
} );
}

when you log in it not searching if you have the same email that is on database
so
it add a new email and ID to the database

how can i change it

i need when the user try to log in and the email is not in the database yet
instead of adding a new spot in the database with email and ID
it shows a message of error

when the user has an email that already exist in the database
when click in profile ( Meu Painel ) > go to the dynamic page that appears to you

Can you help me with this code
how to write it

thanks a lot

Hi Aleo.
I really want to know how can you direct the user to update dynamic page after they hit the login / signup button?

HI bangunrumah can you send me via email what you really need ?