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