diff --git a/src/components/ui/VnImg.vue b/src/components/ui/VnImg.vue new file mode 100644 index 000000000..37072a69e --- /dev/null +++ b/src/components/ui/VnImg.vue @@ -0,0 +1,60 @@ + + + + diff --git a/src/pages/Item/Card/ItemDescriptorImage.vue b/src/pages/Item/Card/ItemDescriptorImage.vue index f16a57548..aceede880 100644 --- a/src/pages/Item/Card/ItemDescriptorImage.vue +++ b/src/pages/Item/Card/ItemDescriptorImage.vue @@ -3,8 +3,7 @@ import { ref, onMounted } from 'vue'; import { useI18n } from 'vue-i18n'; import EditPictureForm from 'components/EditPictureForm.vue'; - -import { useSession } from 'src/composables/useSession'; +import VnImg from 'src/components/ui/VnImg.vue'; import axios from 'axios'; const $props = defineProps({ @@ -27,19 +26,12 @@ const $props = defineProps({ }); const { t } = useI18n(); -const { getTokenMultimedia } = useSession(); const image = ref(null); const editPhotoFormDialog = ref(null); const showEditPhotoForm = ref(false); const warehouseName = ref(null); -const getItemAvatar = async () => { - const token = getTokenMultimedia(); - const timeStamp = `timestamp=${Date.now()}`; - image.value = `/api/Images/catalog/200x200/${$props.entityId}/download?access_token=${token}&${timeStamp}`; -}; - const toggleEditPictureForm = () => { showEditPhotoForm.value = !showEditPhotoForm.value; }; @@ -62,14 +54,17 @@ const getWarehouseName = async (warehouseFk) => { }; onMounted(async () => { - getItemAvatar(); getItemConfigs(); }); + +const handlePhotoUpdated = (evt = false) => { + image.value.reload(evt); +};