fix: await API fileByFile
This commit is contained in:
parent
7d46985570
commit
176b22e756
6 changed files with 38 additions and 21 deletions
|
|
@ -8,6 +8,7 @@ import config from "@/app.config";
|
|||
import type { PropType } from "vue";
|
||||
import type { FormProfile } from "@/interface/main";
|
||||
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
|
||||
import avatarMain from "@/assets/avatar_user.jpg";
|
||||
|
||||
/** importComponents*/
|
||||
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
|
||||
|
|
@ -91,8 +92,11 @@ function fetchProfile(id: string, name: string) {
|
|||
if (profile.avatar === "") {
|
||||
http
|
||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `${name}`))
|
||||
.then(async (res) => {
|
||||
.then((res) => {
|
||||
profile.avatar = res.data.downloadUrl;
|
||||
})
|
||||
.catch(() => {
|
||||
profile.avatar = avatarMain;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import type {
|
|||
GovermentEmpTemp,
|
||||
} from "@/components/information/interface/response/Government";
|
||||
import type { Avatar } from "@/components/information/interface/response/avatar";
|
||||
import avatarMain from "@/assets/avatar_user.jpg";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
|
@ -167,9 +168,9 @@ async function fetchInformation(id: string) {
|
|||
avatar.position = data.position ? data.position : "-";
|
||||
//ถ้ามีรูปเรียก Function fetchProfile เรียกข้อมูลรูปโปรไฟล์
|
||||
if (data.avatarName) {
|
||||
await fetchProfile(data.id as string, data.avatarName);
|
||||
fetchProfile(data.id as string, data.avatarName);
|
||||
} else {
|
||||
avatar.avatar = "";
|
||||
avatar.avatar = avatarMain;
|
||||
}
|
||||
|
||||
if (props.id) {
|
||||
|
|
@ -260,11 +261,14 @@ async function fetchProfileGovTemp(id: string) {
|
|||
* @param id profileID
|
||||
* @param avatarName ชื่อไฟล์
|
||||
*/
|
||||
async function fetchProfile(id: string, avatarName: string) {
|
||||
await http
|
||||
function fetchProfile(id: string, avatarName: string) {
|
||||
http
|
||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
|
||||
.then(async (res) => {
|
||||
avatar.avatar = await res.data.downloadUrl;
|
||||
.then((res) => {
|
||||
avatar.avatar = res.data.downloadUrl;
|
||||
})
|
||||
.catch(() => {
|
||||
avatar.avatar = avatarMain;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue