added reactivity to post delete and patch
This commit is contained in:
		| @ -4,7 +4,6 @@ import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue"; | ||||
| import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue"; | ||||
| import {fetchResearches, } from "@/rest/ScientificPublications/ResearcherProfile.js"; | ||||
| import {getSelf, patchProfile} from "@/rest/ScientificPublications/ManageResearcherProfile.js"; | ||||
| import {c, f} from "../../../dist/assets/_plugin-vue_export-helper-Bvj9NrzX.js"; | ||||
| import ResearchPostComponent from "@/Apps/ScientificPublications/ResearchPostComponent.vue"; | ||||
| const input = ref(""); | ||||
| const isFilterOpened = ref(false); | ||||
| @ -43,7 +42,6 @@ const closeResearch = () => { | ||||
|  | ||||
| function openPostResearch(){ | ||||
|   isPostResearchOpened.value = true | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -81,12 +79,16 @@ function cancelChanges(){ | ||||
|   changing.value = false | ||||
|   toModify= Object.assign({}, {}); | ||||
| } | ||||
| function confirmChanges(){ | ||||
|   patchProfile(researcher.value.id, toModify) | ||||
| async function confirmChanges(){ | ||||
|   await patchProfile(researcher.value.id, toModify) | ||||
|   changing.value = false | ||||
|   toModify= Object.assign({}, {}); | ||||
|   researcher.value = await getSelf(); | ||||
| } | ||||
|  | ||||
| async function modifiedResearch(){ | ||||
|   researchList.value = await fetchResearches(researcher.value.id) | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -94,8 +96,8 @@ function confirmChanges(){ | ||||
|  | ||||
| <template> <div class="body"><div id="main"> | ||||
|     <FilterComponent :isOpen="isFilterOpened" :allArticles="researchList" @modal-close="closeFilter" @submit="submitFilters()"></FilterComponent> | ||||
|     <ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" :manage="true" @modal-close="closeResearch"></ArticleComponent> | ||||
|     <ResearchPostComponent :researcher="researcher" :isOpen="isPostResearchOpened" @modal-close="isPostResearchOpened = false"></ResearchPostComponent> | ||||
|     <ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" :manage="true" @modal-close="closeResearch" @modified="modifiedResearch" ></ArticleComponent> | ||||
|     <ResearchPostComponent :researcher="researcher" :isOpen="isPostResearchOpened" @modal-close="isPostResearchOpened = false" @posted="modifiedResearch"></ResearchPostComponent> | ||||
|     <div id="profilePicture"> | ||||
|       <img src="/Clyde.png" /> | ||||
|     </div> | ||||
|  | ||||
| @ -23,7 +23,7 @@ function format(date){ | ||||
|   return day +"/"+ month +"/"+ year | ||||
| } | ||||
|  | ||||
| const emit = defineEmits(["modal-close","downloadPdf","downloadBibTex"]); | ||||
| const emit = defineEmits(["modal-close","downloadPdf","downloadBibTex","modified"]); | ||||
|  | ||||
| const target = ref(null) | ||||
| onClickOutside(target, ()=>emit('modal-close')) | ||||
| @ -34,15 +34,17 @@ function cancelChanges(){ | ||||
|   toModify= Object.assign({}, {}); | ||||
|   emit('modal-close') | ||||
| } | ||||
| function confirmChanges(){ | ||||
|   patchArticle(props.article.id, toModify) | ||||
| async function confirmChanges(){ | ||||
|   await patchArticle(props.article.id, toModify) | ||||
|   toModify= Object.assign({}, {}); | ||||
|   emit('modal-close') | ||||
|   emit("modified") | ||||
| } | ||||
|  | ||||
| function deleteThisArticle(){ | ||||
|   deleteArticle(props.article.id) | ||||
| async function deleteThisArticle(){ | ||||
|   await deleteArticle(props.article.id) | ||||
|   emit('modal-close') | ||||
|   emit("modified") | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -23,25 +23,25 @@ async function uploadResearchBibTexPdf(pdf){ | ||||
|  | ||||
| // Date when sent!! | ||||
|  | ||||
| function postNewResearch(){ | ||||
| async function postNewResearch(){ | ||||
|   toPost.releaseDate = new Date() | ||||
|   toPost.author = props.researcher | ||||
|   //the Pdf is required and a title | ||||
|   console.log(!toPost.pdfLocation == null|| toPost.title == null || toPost.title === "") | ||||
|   //the Pdf and a title are required | ||||
|   if (toPost.pdfLocation == null || toPost.title == null || toPost.title === "") { | ||||
|     emit("modal-close") | ||||
|     return; | ||||
|   } | ||||
|   postResearch(toPost) | ||||
|   await postResearch(toPost) | ||||
|   toPost = Object.assign({}, {}); | ||||
|   emit("modal-close") | ||||
|   emit("posted") | ||||
| } | ||||
|  | ||||
| function cancelPost(){ | ||||
|   emit("modal-close") | ||||
|   toPost = Object.assign({}, {}); | ||||
| } | ||||
| const emit = defineEmits(["modal-close"]); | ||||
| const emit = defineEmits(["modal-close","posted"]); | ||||
|  | ||||
| const target = ref(null) | ||||
| onClickOutside(target, ()=>emit('modal-close')) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user