🐛 Ignore canceling/dismissing share action

pull/2116/head
Jérémy Rialland 2022-04-25 12:58:44 +02:00 committed by Jérémy Rialland
parent 86319d26e0
commit fd8f0f5db2
1 changed files with 16 additions and 8 deletions

View File

@ -57,14 +57,22 @@ export default function ShareOrSaveSimulationBanner({
const url = useUrl()
const startSharing = async () => {
if (shareAPIAvailable) {
await window.navigator.share({
title: document.title,
text: t(
'shareSimulation.navigatorShare',
'Ma simulation Mon Entreprise'
),
url,
})
try {
await window.navigator.share({
title: document.title,
text: t(
'shareSimulation.navigatorShare',
'Ma simulation Mon Entreprise'
),
url,
})
} catch (e) {
if (e instanceof Error && e.toString().includes('AbortError')) {
return
}
// eslint-disable-next-line no-console
console.error(e)
}
}
}