fixing bug get profile check avatar value

This commit is contained in:
Warunee Tamkoo 2024-05-17 13:43:29 +07:00
parent 0de1e4d525
commit f06f0da910

View file

@ -170,22 +170,29 @@ async function fetchDataPerson(search: boolean = false) {
function insertAvatar(items: DataPerson[]) {
items.map((x: any, index: number) => {
http
.get(
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", x.id, x.avatarName)
)
.then((img) => {
dataPersonMain.value[index] = {
...x,
avatar: img.data.downloadUrl,
};
})
.catch(() => {
dataPersonMain.value[index] = {
...x,
avatar: avatar,
};
});
if (x.avatarName != null) {
http
.get(
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", x.id, x.avatarName)
)
.then((img) => {
dataPersonMain.value[index] = {
...x,
avatar: img.data.downloadUrl,
};
})
.catch(() => {
dataPersonMain.value[index] = {
...x,
avatar: avatar,
};
});
} else {
dataPersonMain.value[index] = {
...x,
avatar: avatar,
};
}
});
}
// const convertImageProfile = (id: string) => {