fix: await API fileByFile
This commit is contained in:
parent
7d46985570
commit
176b22e756
6 changed files with 38 additions and 21 deletions
|
|
@ -532,25 +532,29 @@ async function fetchKeycloakPosition() {
|
|||
await http
|
||||
.get(config.API.keycloakPosition())
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
const data = res.data.result;
|
||||
usePositionKeycloakStore().setPositionKeycloak(data);
|
||||
if (data.avatarName) {
|
||||
await getImg(data.profileId, data.avatarName);
|
||||
getImg(data.profileId, data.avatarName);
|
||||
} else {
|
||||
profileImg.value = avatar;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
profileImg.value = avatar;
|
||||
});
|
||||
}
|
||||
|
||||
const profileImg = ref<string>("");
|
||||
async function getImg(id: string, pathName: string) {
|
||||
await http
|
||||
function getImg(id: string, pathName: string) {
|
||||
http
|
||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
|
||||
.then((res) => {
|
||||
profileImg.value = res.data.downloadUrl;
|
||||
})
|
||||
.catch((err) => {
|
||||
profileImg.value = avatar;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue