CardProfile => CheckAvatar

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-06-11 16:34:25 +07:00
parent b53eaa8fea
commit d2edb44540
2 changed files with 19 additions and 9 deletions

View file

@ -20,10 +20,10 @@ export default {
/** position*/ /** position*/
orgPosPosition: `${orgPos}/position`, orgPosPosition: `${orgPos}/position`,
orgPosPositionById: (id: string) => `${orgPos}/position/${id}`, orgPosPositionById: (id: string) => `${orgPos}/position/${id}`,
orgPosPositionExecutive : () => `${orgPos}/position/executive`, orgPosPositionExecutive: () => `${orgPos}/position/executive`,
orgPosExecutive: `${orgPos}/executive`, orgPosExecutive: `${orgPos}/executive`,
orgPosType: `${orgPos}/type`, orgPosType: `${orgPos}/type`,
orgPosTypeId: (id: string) => `${orgPos}/type/${id}`, orgPosTypeId: (id: string) => `${orgPos}/type/${id}`,
orgPosLevel: `${orgPos}/level`, orgPosLevel: `${orgPos}/level`,
orgPosMaster: `${orgPos}/master`, orgPosMaster: `${orgPos}/master`,
orgPosMasterById: (id: string) => `${orgPos}/master/${id}`, orgPosMasterById: (id: string) => `${orgPos}/master/${id}`,
@ -86,7 +86,10 @@ export default {
orgProfileEmp: `${orgEmployeePos}/profile`, orgProfileEmp: `${orgEmployeePos}/profile`,
orgSearchProfileEmp: `${orgProfile}-employee/search`, orgSearchProfileEmp: `${orgProfile}-employee/search`,
orgProfileById:(id:string,type:string)=>`${orgProfile}${type}/${id}`, orgProfileById: (id: string, type: string) => `${orgProfile}${type}/${id}`,
orgDeceasedProfile:`${orgPos}/profile/search` orgDeceasedProfile: `${orgPos}/profile/search`,
//
orgCheckAvatar: (id: string) => `${orgProfile}/avatar/profileId/${id}`,
}; };

View file

@ -38,7 +38,7 @@ const profileId = ref<string | null>("");
function fetchDataProfile(data: DataProfile) { function fetchDataProfile(data: DataProfile) {
if (data.profileId) { if (data.profileId) {
fetchProfile(data.profileId); fetchCheckAvatar(data.profileId);
} }
profile.id = data.profileId; profile.id = data.profileId;
profile.fullName = `${data.prefix ?? ""}${data.firstName ?? ""} ${ profile.fullName = `${data.prefix ?? ""}${data.firstName ?? ""} ${
@ -72,12 +72,19 @@ function fetchDataProfile(data: DataProfile) {
} }
} }
function fetchProfile(id: string) { function fetchCheckAvatar(id: string) {
http.get(config.API.orgCheckAvatar(id)).then((res) => {
const data = res.data.result;
if (data.avatarName) {
fetchProfile(id, data.avatarName);
}
});
}
function fetchProfile(id: string, name: string) {
if (profile.avatar === "") { if (profile.avatar === "") {
http http
.get( .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `${name}`))
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`)
)
.then(async (res) => { .then(async (res) => {
profile.avatar = res.data.downloadUrl; profile.avatar = res.data.downloadUrl;
}); });