fix: await API fileByFile

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-05-25 13:17:13 +07:00
parent 7d46985570
commit 176b22e756
6 changed files with 38 additions and 21 deletions

View file

@ -323,10 +323,10 @@ async function uploadFileURL(uploadUrl: string, file: any) {
* งกนดงขอมลรปโปรไฟล
* @param id โปรไฟล
*/
async function fetchProfile(id: string) {
await http
function fetchProfile(id: string) {
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
.then(async (res) => {
.then((res) => {
profilePicture.value = res.data.downloadUrl;
})
.catch(() => {
@ -403,7 +403,7 @@ async function fetchDataPersonal() {
fileName.value = res.data.result.avatarName;
if (formDetail.value?.avatarName) {
await fetchProfile(profileId.value);
fetchProfile(profileId.value);
} else {
profilePicture.value = avatar;
}

View file

@ -52,7 +52,7 @@ function fetchInformation() {
citizenId.value = data.citizenId;
if (data.avatarName) {
await fetchProfile(data.id as string, data.avatarName);
fetchProfile(data.id as string, data.avatarName);
} else {
avatar.value = avatarMain;
}
@ -70,11 +70,14 @@ function fetchInformation() {
* @param id profileId
* @param avatarName อไฟล
*/
async function fetchProfile(id: string, avatarName: string) {
function fetchProfile(id: string, avatarName: string) {
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
.then(async (res) => {
.then((res) => {
avatar.value = res.data.downloadUrl;
})
.catch(() => {
avatar.value = avatarMain;
});
}

View file

@ -8,6 +8,7 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/14_KPI/store";
import avatar from "@/assets/avatar_user.jpg";
import DialogHeader from "@/components/DialogHeader.vue";
import type { FormProfile } from "@/modules/14_KPI/interface/request/index";
@ -65,7 +66,7 @@ async function fetchEvaluation() {
await store.checkCompetency();
await store.checkCompetencyDefaultCompetencyLevel();
await fetchProfile(data.profileId);
fetchProfile(data.profileId);
plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint;
rolePoint.value = data.rolePoint == null ? "" : data.rolePoint;
@ -81,8 +82,8 @@ async function fetchEvaluation() {
// });
}
async function fetchProfile(id: string) {
await http
function fetchProfile(id: string) {
http
.get(
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`)
)
@ -90,6 +91,7 @@ async function fetchProfile(id: string) {
store.dataEvaluation.avartar = res.data.downloadUrl;
})
.catch(() => {
store.dataEvaluation.avartar = avatar;
// profilePicture.value = avatar;
});
}