added reactivity to post delete and patch

This commit is contained in:
2024-04-18 16:17:16 +02:00
parent 939b4f5492
commit 7394a23b45
3 changed files with 20 additions and 16 deletions

View File

@ -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")
}