From 496c58c00e6497356143a66524173140801515ab Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Tue, 11 May 2021 14:37:03 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fallback=20en=20cas=20d'erreur?= =?UTF-8?q?=20sur=20l'API=20de=20partage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ShareSimulationBanner.tsx | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mon-entreprise/source/components/ShareSimulationBanner.tsx b/mon-entreprise/source/components/ShareSimulationBanner.tsx index 685b2bb30..3f05cec91 100644 --- a/mon-entreprise/source/components/ShareSimulationBanner.tsx +++ b/mon-entreprise/source/components/ShareSimulationBanner.tsx @@ -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) }