瀏覽代碼

Correct letterhead rendering when avatar is missing

master
Immanuel Onyeka 1 年之前
父節點
當前提交
ea8b32df2e
共有 1 個文件被更改,包括 11 次插入6 次删除
  1. +11
    -6
      components/app.vue

+ 11
- 6
components/app.vue 查看文件

@@ -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
}
})

}


Loading…
取消
儲存