mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Properly await and handle share errors
This commit is contained in:
@@ -40,12 +40,15 @@
|
|||||||
try {
|
try {
|
||||||
let url = new URL(canonical);
|
let url = new URL(canonical);
|
||||||
url.searchParams.set("utm_medium", "share");
|
url.searchParams.set("utm_medium", "share");
|
||||||
navigator.share({
|
await navigator.share({
|
||||||
title: data.post.title,
|
title: data.post.title,
|
||||||
text: data.post.description,
|
text: data.post.description,
|
||||||
url: url.href,
|
url: url.href,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
|
if (error.toString().includes("AbortError")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
webShareAPISupported = false;
|
webShareAPISupported = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -168,7 +171,9 @@
|
|||||||
<h1 id="title" class="p-name">{data.post.title}</h1>
|
<h1 id="title" class="p-name">{data.post.title}</h1>
|
||||||
<aside>
|
<aside>
|
||||||
<a class="u-url ib" href={canonical}
|
<a class="u-url ib" href={canonical}
|
||||||
>Published on <time class="dt-published ib" datetime={data.post.date}
|
>Published on <time
|
||||||
|
class="dt-published ib"
|
||||||
|
datetime={data.post.date}
|
||||||
>{new Date(data.post.date).toLocaleDateString()}</time
|
>{new Date(data.post.date).toLocaleDateString()}</time
|
||||||
></a
|
></a
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user