Need help Wix Team

I need to talk to wix team member, Is it possible?

This forum is a community of Corvid developers and users where various topics are discussed and information shared. It is not a support site.

This forum is dedicated to Corvid. You can post your code questions here.

For questions that are not related to code you can contact Wix Customer Care . You’ll get better help for your problem there.

Hi, I need help with the code. Could you please check this.

import wixData from 'wix-data';
import {session} from 'wix-storage';
import {local} from 'wix-storage';
import wixLocation from "wix-location"; 
import wixUsers from 'wix-users';
import wixWindow from 'wix-window'; 

$w.onReady(function () {

$w('#dataset5').refresh();

 var store = local.getItem("login");
 //console.log(store);
 if (store === null || store === undefined){
        $w("#button26").hide();
        $w("#button1").hide();
    }
 else{
 const currentUser = wixUsers.currentUser;
 let userEmail; 
    console.log(currentUser.loggedIn);
    currentUser.getEmail()
  .then( (email) => {
      userEmail = email;    
      console.log(userEmail);
       wixData.query("artistpages")
        .eq("email", userEmail)
        .find()
        .then( (results) => {
 if(results.items.length > 0) {
        $w("#button26").show();
        $w("#button1").show();
    }
 else{
        $w("#button26").hide(); // Profile picture
        $w("#button1").hide(); // Update details
    }
        })
  })
    }

This is not working. Llink - pollywoodcafe.com > Artist > View Profile

I want to make sure only logged in person can update their details & button should not be shown on someone else profile. Please let me know if you can get the information. Else, let me know about required details.

The error message explains exactly what the problem is…
“The dataset didn’t load yet. You need to call refresh inside the onReady for the dataset.”

See the article Datasets have an onReady function for more information.

Hi, I’ve added the code but still getting the same error.

// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixData from ‘wix-data’ ;
import {session} from ‘wix-storage’ ;
import {local} from ‘wix-storage’ ;
import wixLocation from “wix-location” ;
import wixUsers from ‘wix-users’ ;
import wixWindow from ‘wix-window’ ;

$w.onReady( function () {
$w( “#dynamicDataset” ).onReady( () => {
$w( “#dynamicDataset” ).refresh();

var store = local.getItem( “login” );
//console.log(store);
if (store === null || store === undefined){
$w( “#button26” ).hide();
$w( “#button1” ).hide();
}
else {
const currentUser = wixUsers.currentUser;
let userEmail;
console.log(currentUser.loggedIn);
currentUser.getEmail()
.then( (email) => {
userEmail = email;
console.log(userEmail);
wixData.query( “artistpages” )
.eq( “email” , userEmail)
.find()
.then( (results) => {
if (results.items.length > 0 ) {
$w( “#button26” ).show();
$w( “#button1” ).show();
}
else {
$w( “#button26” ).hide();
$w( “#button1” ).hide();
}
})
})
}
} );
});

Hi, I’ve updated the code & no issues. But buttons not displaying according to the condition. Please help me with this.

// For full API documentation, including code examples, visit https://wix.to/94BuAAs
import wixData from 'wix-data';
import {session} from 'wix-storage';
import {local} from 'wix-storage';
import wixLocation from "wix-location"; 
import wixUsers from 'wix-users';
import wixWindow from 'wix-window'; 

$w.onReady(function () {
    $w("#button26").hide();
    $w("#button1").hide();
 
    $w("#dynamicDataset").onReady( () => {
        $w("#dynamicDataset").refresh();

 var store = local.getItem("login");
 //console.log(store);
 if (store === null || store === undefined){
        console.log("Login");
    }

 else{
 const currentUser = wixUsers.currentUser;
 let userEmail; 
 //console.log(currentUser.loggedIn);
        currentUser.getEmail()
        .then( (email) => {
        userEmail = email;    


       wixData.query("artistpages")
        .find()
        .then( (results) => {
 if(results.items.length > 0) {

 //console.log("Working?");
 var artistemail = results.items[0].email;
 //console.log("Wix Login "+userEmail);
 //console.log("Artist Data "+artistemail);

 if (userEmail === store){
            console.log("Yes Loop WOrking");
            $w("#button26").show();
            $w("#button1").show();
            }
 else{
                $w("#button26").hide();
            $w("#button1").hide();
            }
        }
 else{
        console.log("No Loop WOrking");
        $w("#button26").hide();
        $w("#button1").hide();
        }
        });
  });
}


        } );
});

What is the condition you want? What is the value of store ? Use console.log() to see what the values of the variables are.

You will have to inspect your variables and see what the values are. If they aren’t what you expect, then you’ll have to check your code to see why.

Hi, in store I’ve local data like email. Although, I solved the errors & make it working. But I’ve one quick question: “Is it safe to store email in local storage?”