When I’m testing my site using different accounts, I can’t open up the profile page that I coded for my site members. Instead, this message pops up: “there’s nothing here… we can’t find the page you’re looking for. Check the URL, or head back home.” The profile pages were working perfectly up until now, and I really need to fix this.
Here is a copy of my code, just in case you see anything wrong:
import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w(“#button13”).label = “Logout”;
$w(“#button12”).show();
}
else {
$w(“#button13”).label = “Login”;
$w(“#button12”).hide();
}
} );
export function button13_onclick() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#button13”).label = “Login”;
$w(“#button12”).hide();
} );
}
// user is logged out
else {
let userId;
let userEmail;
// prompt the user to log in
wixUsers.promptLogin( {“mode”: “login”} )
.then( (user) => {
userId = user.id ;
return user.getEmail();
} )
.then( (email) => {
// check if there is an item for the user in the collection
userEmail = email;
return wixData.query(“Profile”)
.eq(“_id”, userId)
.find();
} )
.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(“Profile”, toInsert)
.catch( (err) => {
console.log(err);
} );
}
// update buttons accordingly
$w(“#button13”).label = “Logout”;
$w(“#button12”).show();
} )
.catch( (err) => {
console.log(err);
} );
}
}
export function button12_onclick() {
wixLocation.to (/Profile/Update/${ [wixUsers.currentUser.id](http://wixusers.currentuser.id/) }
);
}
Thanks in advance to anyone who helps out!
Have you tried debugging the code yourself in Developer Console?
Hi pawtalog ,
Can you please share the link to your site ?
Roi Bendet
Hi Roi Bendet,
Thanks for helping out!
Here is the link to my site: https://www.pawtalog.com/
Here is the link to the exact page the code is on: https://www.pawtalog.com/account
Just a reminder: The page with the code that I’m having problems with is called “My Account”. When you open up my editor, just click on that page and you should see the code.
Thanks again for your help!
-Pawtalog
Hi Pawtalog,
I’ve signed up to your site, signed in and it worked.
Lets try to work this through together.
I looked into your Profile collection, how did you add the items ? manually or through the signup feature ?
Roi
The items are automatically added through the signup feature.
Ok,
It works for me. can you please describe more detailed scenario ?
Roi
Some of my users are experiencing this:
When they click on “my account” and then “my profile”, they get this error message that the page couldn’t be found. This makes no sense though because the code is supposed to generate a new page/ID for everyone. I did a test myself by creating an account and clicking on “my profile”, and the same thing happened. It’s interesting that you are able to go to the profile page. Are you sure you are clicking:
my profile>login/sign up>my profile
Can you please capture video of the scenario ?
You can use Jing
Roi
It’s happened to me as well… I just transferred ownership to other account and then the page was crazy like hell…my login didnt work really well and it’s just something bug in the login coding…i dont know how to debug since before this, it works really well
Ok, now it seems to be working. While I was recording the video you asked me to record, I could successfully enter the profile page! Thanks for helping!
-Pawtalog
Great!
Estou com problemas no site
coloquei um link direcionando para uma pagina do site, e quando eu coloco para visualizar funciona, mas quando coloca o link do site ele não funciona. aparece esta mensagem…
Hello, I have the same page that appears (same as the screenshots of this conversation) when I share the page via the link or when I reload it after modification, while on the site the links on some pages to this dynamic page work, how to fix this problem please ?