diff --git a/components/social-elements/notes/note.vue b/components/social-elements/notes/note.vue index 94fa0b4..a20ceba 100644 --- a/components/social-elements/notes/note.vue +++ b/components/social-elements/notes/note.vue @@ -70,10 +70,16 @@ - + Copy Link + + + Delete + + @@ -89,6 +95,10 @@ const props = defineProps<{ small?: boolean; }>(); +const emits = defineEmits<{ + delete: []; +}>(); + // Handle reblogs const note = computed(() => props.note?.reblog ?? props.note); const noteClosed = ref( @@ -96,25 +106,26 @@ const noteClosed = ref( ); const { copy } = useClipboard(); -const client = useMegalodon(); +const tokenData = useTokenData(); +const client = useMegalodon(tokenData); const mentions = await useResolveMentions( note.value?.mentions ?? [], client.value, ); const eventualReblogAccountName = props.note?.reblog ? useParsedContent( - props.note?.account.display_name, - props.note?.account.emojis, - mentions.value, - ).value + props.note?.account.display_name, + props.note?.account.emojis, + mentions.value, + ).value : null; const content = note.value && process.client ? useParsedContent( - note.value.content, - note.value.emojis, - mentions.value, - ) + note.value.content, + note.value.emojis, + mentions.value, + ) : ""; const numberFormat = (number = 0) => new Intl.NumberFormat(undefined, { @@ -124,6 +135,15 @@ const numberFormat = (number = 0) => }).format(number); const attachments = note.value?.media_attachments ?? []; const noteUrl = note.value && `/@${note.value.account.acct}/${note.value.id}`; + +const deleteNote = async () => { + const result = await client.value?.deleteStatus(note.value?.id ?? ""); + + if (result?.data) { + console.log("Status deleted", result.data); + emits('delete') + } +};