Quellcode durchsuchen

Correct letterhead rendering when avatar is missing

master
Immanuel Onyeka vor 1 Jahr
Ursprung
Commit
ea8b32df2e
1 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen
  1. +11
    -6
      components/app.vue

+ 11
- 6
components/app.vue Datei anzeigen

@@ -110,20 +110,25 @@ function getUser() {
return getAvatar(token)
}).then(b => {
if (!b) return // Exit if token is invalid
const validTypes = ['image/jpeg', 'image/png']
if (!b || !validTypes.includes(b.type) || b.size <= 1) {
return fetch("/assets/image/default-avatar.jpg").
fetch("/assets/image/default-avatar.jpg").
then(r => r.blob()).then( a => this.user.avatar = a )
} else {
this.user.avatar = b
}
this.user.avatar = b
return getLetterhead(token)
}).then(b => {
if (!b) return // Exit if token is invalid
const validTypes = ['image/jpeg', 'image/png']
this.user.letterhead = b
const validTypes = ['image/jpeg', 'image/png']
if (!b || !validTypes.includes(b.type) || b.size <= 1) {
fetch("/assets/image/default-avatar.jpg").
then(r => r.blob()).then( a => this.user.letterhead = a )
} else {
this.user.letterhead = b
}
})

}


Laden…
Abbrechen
Speichern