Implement delete note

This commit is contained in:
syuilo
2018-05-28 14:39:46 +09:00
parent 85114ebd74
commit ceda2ca896
15 changed files with 125 additions and 23 deletions

View File

@ -4,6 +4,7 @@
<div class="popover" :class="{ compact }" ref="popover">
<button @click="favorite">%i18n:@favorite%</button>
<button v-if="note.userId == $store.state.i.id" @click="pin">%i18n:@pin%</button>
<button v-if="note.userId == $store.state.i.id" @click="del">%i18n:@delete%</button>
<a v-if="note.uri" :href="note.uri" target="_blank">%i18n:@remote%</a>
</div>
</div>
@ -59,6 +60,15 @@ export default Vue.extend({
});
},
del() {
if (!window.confirm('%i18n:@delete-confirm%')) return;
(this as any).api('notes/delete', {
noteId: this.note.id
}).then(() => {
this.$destroy();
});
},
favorite() {
(this as any).api('notes/favorites/create', {
noteId: this.note.id