🐛 Fallback en cas d'erreur sur l'API de partage

pull/1536/head
Maxime Quandalle 2021-05-11 14:37:03 +02:00
parent 145080f3af
commit 496c58c00e
1 changed files with 12 additions and 8 deletions

View File

@ -28,14 +28,18 @@ export default function ShareSimulationBanner() {
const startSharing = () => {
if (shareAPIAvailable) {
window.navigator.share({
title: document.title,
text: t(
'shareSimulation.navigatorShare',
'Ma simulation Mon Entreprise'
),
url: getUrl(),
})
try {
window.navigator.share({
title: document.title,
text: t(
'shareSimulation.navigatorShare',
'Ma simulation Mon Entreprise'
),
url: getUrl(),
})
} catch {
setOpened(true)
}
} else {
setOpened(true)
}