Skip to content

Commit

Permalink
Merge pull request #15 from AIO-Develope/share-uploads
Browse files Browse the repository at this point in the history
Share uploads
  • Loading branch information
aiomayo authored Jul 6, 2024
2 parents c152838 + 0b7f826 commit c884041
Show file tree
Hide file tree
Showing 5 changed files with 368 additions and 129 deletions.
78 changes: 78 additions & 0 deletions src/components/widgets/linking/openShareLinkModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template>
<div>
<ImageModal
:show-modal="modalId !== null"
:modal-content="modalContent"
@close="modalId = null"
/>
</div>
</template>

<script>
import ImageModal from '@/components/widgets/modals/UploadModal.vue';
import axiosService from '@/services/axiosService';
export default {
components: {
ImageModal,
},
data() {
return {
images: [],
showInfoBox: false,
modalId: null,
page: 1,
loading: false,
hasMore: true,
imageType: 'pfp',
userid: '',
modalContent: {},
};
},
mounted() {
try {
this.imgId = this.$route.params.imgId;
if (this.imgId) {
this.openModal(this.imgId);
}
} catch (error) {
console.log("Error while mounting:", error);
}
},
methods: {
async openModal(imgId) {
this.modalId = imgId;
try {
const modalupload = await axiosService.getImageDetails(this.modalId);
if (!modalupload) {
console.log("image not found")
return;
}
const newModalContent = modalupload.upload;
let authorInfo = null;
try {
authorInfo = await axiosService.getUser('userId', newModalContent.authorId);
} catch (error) {
console.error("Error fetching author with id:", newModalContent.authorId);
}
this.modalContent = {
id: newModalContent.id,
title: newModalContent.title,
description: newModalContent.description,
type: newModalContent.type,
tags: newModalContent.tags,
imgId: imgId,
authorId: newModalContent.authorId || null,
username: authorInfo?.user?.username || null,
uploadedDate: newModalContent.uploadedDate,
};
} catch (error) {
console.error("Error fetching image details:", error);
this.$router.push('/');
}
},
},
};
</script>
Loading

0 comments on commit c884041

Please sign in to comment.