Skip to content

Commit 8e5ead7

Browse files
committed
Implement delete tweet confirm
1 parent ca42c56 commit 8e5ead7

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

frontend/src/components/view/tweet/Tweet.vue

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,25 @@ export default {
122122
this.isEditTweetModalActive = true;
123123
},
124124
125-
async onDeleteTweet() {
126-
// @todo add dialog confirm
127-
await this.deleteTweet(this.tweet.id);
128-
129-
this.$router.push({ name: 'feed' });
125+
onDeleteTweet() {
126+
this.$dialog.confirm({
127+
title: 'Deleting tweet',
128+
message: 'Are you sure you want to <b>delete</b> your tweet? This action cannot be undone.',
129+
confirmText: 'Delete Tweet',
130+
type: 'is-danger',
131+
onConfirm: async () => {
132+
try {
133+
await this.deleteTweet(this.tweet.id);
134+
this.$toast.open('Tweet deleted!');
135+
this.$router.push({ name: 'feed' });
136+
} catch {
137+
this.$toast.open({
138+
message: 'Unable to delete tweet!',
139+
type: 'is-danger',
140+
});
141+
}
142+
}
143+
});
130144
},
131145
132146
showImageModal() {

0 commit comments

Comments
 (0)