the profile view was not resetting to guest view after signing out because i forgot to add the event lister to the connected callback. now when you sign out, the profile view resets to guest view.

This commit is contained in:
miggymofongo 2024-12-05 22:43:39 -04:00
parent 4563149393
commit f68fab11eb

View file

@ -109,7 +109,7 @@ Profile Picture Container
`]; `];
async firstUpdated() { async firstUpdated() {
// this method is a lifecycle even in lit // this method is a lifecycle event in lit
// for more info check out the lit docs https://lit.dev/docs/components/lifecycle/ // for more info check out the lit docs https://lit.dev/docs/components/lifecycle/
console.log('This is your home page'); console.log('This is your home page');
} }
@ -118,9 +118,10 @@ Profile Picture Container
connectedCallback(): void { connectedCallback(): void {
super.connectedCallback(); super.connectedCallback();
window.addEventListener('profile-updated', this.updateProfileFromEvent.bind(this)); window.addEventListener('profile-updated', this.updateProfileFromEvent.bind(this));
this.addEventListener('user-signed-out', this.handlesSignOut);
const storedPubkey = localStorage.getItem('pubkey'); const storedPubkey = localStorage.getItem('pubkey');
if (storedPubkey) { if (storedPubkey) {
// Manually fetch profile metadata on mount // manually fetch profile metadata on mount
this.nostrAddy = 'loading...'; this.nostrAddy = 'loading...';
this.bio = 'loading profile...'; this.bio = 'loading profile...';
this.profilePic = '/assets/img/default_pfp.png'; this.profilePic = '/assets/img/default_pfp.png';