Compare commits

..

No commits in common. "ed29d779b4cc71685ca9e444f527ada8fbe7e2c6" and "d4b1eceaa1ac81584a9261d79e9f14be5e8c2f62" have entirely different histories.

View File

@ -32,44 +32,20 @@ export class AuthController {
* or error if otherwise * or error if otherwise
*/ */
async authenticateAndFindMetadata(pubkey: string) { async authenticateAndFindMetadata(pubkey: string) {
const emptyMetadata = this.metadataController.getEmptyMetadataEvent()
emptyMetadata.content = JSON.stringify({
picture: getRoboHashPicture(pubkey)
})
this.metadataController this.metadataController
.findMetadata(pubkey) .findMetadata(pubkey)
.then((event) => { .then((event) => {
if (event) { store.dispatch(setMetadataEvent(event))
// In case of NIP05 there is scenario where login content will be populated but without an image
// In such case we will add robohash image
if (event.content) {
const content = JSON.parse(event.content)
if (!content) {
event.content = ''
}
if (!content.picture) {
content.picture = getRoboHashPicture(pubkey)
}
event.content = JSON.stringify(content)
} else {
event.content = JSON.stringify({
picture: getRoboHashPicture(pubkey)
})
}
store.dispatch(setMetadataEvent(event))
} else {
store.dispatch(setMetadataEvent(emptyMetadata))
}
}) })
.catch((err) => { .catch((err) => {
console.warn('Error occurred while finding metadata', err) console.warn('Error occurred while finding metadata', err)
const emptyMetadata = this.metadataController.getEmptyMetadataEvent()
emptyMetadata.content = JSON.stringify({
picture: getRoboHashPicture(pubkey)
})
store.dispatch(setMetadataEvent(emptyMetadata)) store.dispatch(setMetadataEvent(emptyMetadata))
}) })