Pinafore-Web-Client-Frontend/src/routes/_actions/share.js

15 lines
426 B
JavaScript
Raw Normal View History

import { toast } from '../_components/toast/toast'
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText'
export async function shareStatus (status) {
try {
await navigator.share({
title: status.spoiler_text || undefined,
text: statusHtmlToPlainText(status.content, status.mentions),
url: status.url
})
} catch (e) {
2019-08-20 04:08:59 +02:00
toast.say('Unable to share: ' + (e.message || ''))
}
}