Fix post sharing URL

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-11-02 17:45:49 +01:00
parent dd3e99bc5e
commit 7ee79a00e2
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -2,7 +2,7 @@
<share-modal
:title="t('Share this post')"
:text="post.title"
:url="postURL"
:url="post.url ?? ''"
:input-label="t('Post URL')"
>
<o-notification
@ -11,7 +11,7 @@
:closable="false"
>
{{
$t(
t(
"This post is accessible only through it's link. Be careful where you post this link."
)
}}
@ -22,29 +22,14 @@
<script lang="ts" setup>
import { PostVisibility } from "@/types/enums";
import { IPost } from "../../types/post.model";
import RouteName from "@/router/name";
import { computed } from "vue";
import { useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
import ShareModal from "@/components/Share/ShareModal.vue";
const props = defineProps<{
defineProps<{
post: IPost;
}>();
const { t } = useI18n({ useScope: "global" });
const router = useRouter();
const postURL = computed((): string => {
if (props.post.id) {
return router.resolve({
name: RouteName.POST,
params: { id: props.post.id },
}).href;
}
return props.post.url ?? "";
});
</script>
<style lang="scss" scoped>
.diaspora,