fix get name

This commit is contained in:
PhilReact 2023-12-27 16:50:04 +02:00
parent eb22b0cda6
commit 3f4d7bbb29

View File

@ -35,7 +35,9 @@ class BeginnerChecklist extends connect(store)(LitElement) {
this.hasName = null; this.hasName = null;
this.nodeUrl = this.getNodeUrl(); this.nodeUrl = this.getNodeUrl();
this.myNode = this.getMyNode(); this.myNode = this.getMyNode();
this.hasTourFinished = false; this.hasTourFinished = JSON.parse(
localStorage.getItem('hasViewedTour') || 'false'
)
this._controlTourFinished = this._controlTourFinished.bind(this); this._controlTourFinished = this._controlTourFinished.bind(this);
this.uid = new ShortUniqueId(); this.uid = new ShortUniqueId();
} }
@ -82,6 +84,7 @@ class BeginnerChecklist extends connect(store)(LitElement) {
async getName(recipient) { async getName(recipient) {
try { try {
if(!recipient) return ''
const endpoint = `${this.nodeUrl}/names/address/${recipient}`; const endpoint = `${this.nodeUrl}/names/address/${recipient}`;
const res = await fetch(endpoint); const res = await fetch(endpoint);
const getNames = await res.json(); const getNames = await res.json();
@ -104,11 +107,11 @@ class BeginnerChecklist extends connect(store)(LitElement) {
this.syncPercentage = state.app.nodeStatus.syncPercent; this.syncPercentage = state.app.nodeStatus.syncPercent;
if ( if (
!this.hasAttempted && !this.hasAttempted && state.app.selectedAddress &&
state.app.nodeStatus.syncPercent === 100 state.app.nodeStatus.syncPercent === 100
) { ) {
this.hasAttempted = true; this.hasAttempted = true;
this.getName(); this.getName(state.app.selectedAddress.address);
} }
} }
if ( if (
@ -137,7 +140,6 @@ class BeginnerChecklist extends connect(store)(LitElement) {
render() { render() {
return this.hasName === false || !this.hasTourFinished return this.hasName === false || !this.hasTourFinished
? html` ? html`
<div class="layout"> <div class="layout">