fixed image profile to store
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m30s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m30s
This commit is contained in:
parent
005cdbd95b
commit
001e7d3580
2 changed files with 19 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
|
|
@ -185,12 +185,6 @@ async function fetchKeycloakPosition() {
|
|||
privacyStore.modalPrivacy = !existingData.privacyCheckin
|
||||
privacyStore.setAccepted(existingData.privacyCheckin)
|
||||
|
||||
//เช็คว่ามีรูปไหม ถ้ามีรูปเรียกข้อมูลรูป
|
||||
if (existingData.avatarName) {
|
||||
getImg(existingData.profileId, existingData.avatarName)
|
||||
} else {
|
||||
profileImg.value = avatar
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +216,7 @@ async function fetchKeycloakPosition() {
|
|||
if (keycloakData.avatarName) {
|
||||
getImg(keycloakData.profileId, keycloakData.avatarName)
|
||||
} else {
|
||||
profileImg.value = avatar
|
||||
positionKeycloakStore.setProfileImg(avatar)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -230,12 +224,15 @@ async function fetchKeycloakPosition() {
|
|||
})
|
||||
}
|
||||
|
||||
const profileImg = ref<string>('')
|
||||
const profileImg = computed({
|
||||
get: () => positionKeycloakStore.profileImg,
|
||||
set: (value) => positionKeycloakStore.setProfileImg(value),
|
||||
})
|
||||
function getImg(id: string, pathName: string) {
|
||||
http
|
||||
.get(config.API.fileByFile('ทะเบียนประวัติ', 'โปรไฟล์', id, pathName))
|
||||
.then((res) => {
|
||||
profileImg.value = res.data.downloadUrl
|
||||
positionKeycloakStore.setProfileImg(res.data.downloadUrl)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue