SolidScribe/client/src/components/NoteDeleteButtonComponent.vue
Max G 5096e74a60 * Removed arrows from notification
* Added trash can function
* Tweaked status text to always be the same
* Removed some open second note code
* Edior always focuses on text now
* Added some extra loading note messages
* Notes are now removed from search index when deleted
* Lots more things happen and update in real time on multiple machines
* Shared notes can be reverted
* WAY more tests
* Note Categories are much more reliable
* Lots of code is much cleaner
2020-05-18 07:45:35 +00:00

43 lines
1.1 KiB
Vue

<template>
<span>
<span class="clickable" @click="confirmDelete()" v-if="click == 0" data-tooltip="Delete Forever" data-inverted="" data-position="top right">
<i class="trash alternate icon"></i>
</span>
<span class="clickable" @click="actuallyDelete()" @mouseleave="reset" v-if="click == 1" data-tooltip="Click again to delete." data-position="top right" data-inverted="">
<i class="red trash alternate icon"></i>
</span>
</span>
</template>
<script>
import axios from 'axios'
export default {
name: 'NoteTitleDisplayCard',
props: [ 'noteId', 'displayText' ],
data () {
return {
click: 0,
}
},
methods:{
confirmDelete(){
this.click++
},
actuallyDelete(){
axios.post('/api/note/delete', {'noteId':this.noteId}).then(response => {
if(response.data == true){
this.$bus.$emit('note_deleted', this.noteId)
this.$store.dispatch('fetchAndUpdateUserTotals')
}
})
.catch(error => { this.$bus.$emit('notification', 'Failed to Delete Note') })
},
reset(){
this.click = 0
}
}
}
</script>