diff --git a/src/boot/quasar.js b/src/boot/quasar.js index a8d9b7ad9a..b4d1044cfc 100644 --- a/src/boot/quasar.js +++ b/src/boot/quasar.js @@ -3,4 +3,11 @@ import qFormMixin from './qformMixin'; export default boot(({ app }) => { app.mixin(qFormMixin); + app.config.globalProperties.$emitEvent = function (eventName, payload) { + app._instance?.emit(eventName, payload); + }; + + app.config.globalProperties.$onEvent = function (eventName, callback) { + app._instance?.on(eventName, callback); + }; }); diff --git a/src/components/ui/VnImg.vue b/src/components/ui/VnImg.vue index 02cec5702a..37072a69ee 100644 --- a/src/components/ui/VnImg.vue +++ b/src/components/ui/VnImg.vue @@ -1,5 +1,5 @@ diff --git a/src/pages/Item/Card/ItemDescriptorImage.vue b/src/pages/Item/Card/ItemDescriptorImage.vue index 5a0e84b457..aceede8808 100644 --- a/src/pages/Item/Card/ItemDescriptorImage.vue +++ b/src/pages/Item/Card/ItemDescriptorImage.vue @@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n'; import EditPictureForm from 'components/EditPictureForm.vue'; import VnImg from 'src/components/ui/VnImg.vue'; -import { useSession } from 'src/composables/useSession'; 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); +};