fix API ProfileAvatar

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-06-06 14:31:51 +07:00
parent 6a320b91ff
commit 755f9804f0

View file

@ -80,11 +80,6 @@ const baseItemsMenu = ref<DataOptionSys[]>([
name: "ช่วยราชการ",
system: "SYS_TEMPDUTY",
},
// {
// id: "2",
// name: "",
// system: "SYS_TEMPDUTY2",
// },
{
id: "3",
name: "แต่งตั้ง-เลื่อน-ย้าย",
@ -237,7 +232,7 @@ async function uploadImg() {
showLoader();
newProfileFile.value = await resizeImage(profileFile.value);
closeImage();
http
await http
.post(config.API.orgProfileAvatarbyType(empType.value), {
profileId: empType.value == "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
@ -248,6 +243,8 @@ async function uploadImg() {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
@ -628,8 +625,11 @@ function openDialogImg() {
/** ฟังก์ชันเรียกข้อมูลรูป*/
async function getImage() {
showLoader();
http
.get(config.API.orgProfileAvatar + `/${profileId.value}`)
images.value = [];
await http
.get(
config.API.orgProfileAvatarbyType(empType.value) + `/${profileId.value}`
)
.then(async (res) => {
let data = res.data.result;
if (!data || !Array.isArray(data)) {
@ -685,14 +685,14 @@ function closeImage() {
function deletePhoto(id: string) {
dialogRemove(
$q,
() => {
async () => {
showLoader();
http
.delete(config.API.orgProfileAvatar + `/${id}`)
images.value = [];
imagesAlldata.value = [];
await http
.delete(config.API.orgProfileAvatarbyType(empType.value) + `/${id}`)
.then(async () => {
await getImage();
images.value = [];
imagesAlldata.value = [];
})
.catch((e) => {
messageError($q, e);
@ -714,7 +714,10 @@ function selectAvatarHistory() {
const data = activeImage.value;
showLoader();
http
.get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
.get(
config.API.orgProfileAvatarbyType(empType.value) +
`/select/${profileId.value}/${data.id}`
)
.then(async () => {
await fetchDataPersonal();
await fetchProfile(profileId.value);