I get errors
and I don’t know why they are, I just want while the session is active, the email entry and password disappear while the button continues to go to the main page, and after the session expires, go back to show the entry
import {local} from 'wix-storage';
onlineState = wixStorage.session.getItem("onlineState");
if(onlineState === "true") {
//$w("#text170").show()
//$w("#button1").hide()
let data = JSON.stringify({
element: "email",
command: "hide",
});
local.setItem("key1", data);
const key = local.getItem('key1');
// Make sure the specified key has data
if (typeof key === 'string') {
// convert the data into an object
const data = JSON.parse(key);
// Make sure our both properties are valid
if (data.element && data.command) {
// Make sure there is an element with the gived ID.
if ($w('#${data.element}').id === data.element) {
// Make sure the specified command is present befoer calling it.
if ($w('#${data.element}')[data.command]) {
// Now you can safely excute the command.
$w('#${data.element}')[data.command]();
return true;
}
}
}
}
return false;
}
how can I solve that ?

