diff --git a/src/wireframes/components/actions/use-server.ts b/src/wireframes/components/actions/use-server.ts index 41308bf..f92c956 100644 --- a/src/wireframes/components/actions/use-server.ts +++ b/src/wireframes/components/actions/use-server.ts @@ -128,6 +128,7 @@ export function useServer() { duration: 1, }); } + return; } const fetchSlide = async (messageApi: MessageInstance, messageKey: string) => { @@ -138,14 +139,16 @@ export function useServer() { window.open(linkSlide, '_blank'); } catch (err) { messageApi.error(`${err}`); - } finally { - messageApi.open({ - key: messageKey, - type: 'success', - content: `Preparing completed. Your presentation will be opened in a new tab.`, - duration: 1, - }); + return; } + + messageApi.open({ + key: messageKey, + type: 'success', + content: `Preparing completed. Your presentation will be opened in a new tab.`, + duration: 1, + }); + return; } return { slide: fetchSlide, pdf: fetchPdf }; diff --git a/src/wireframes/components/headers/PresentHeader.tsx b/src/wireframes/components/headers/PresentHeader.tsx index e147d5f..a7fb8b3 100644 --- a/src/wireframes/components/headers/PresentHeader.tsx +++ b/src/wireframes/components/headers/PresentHeader.tsx @@ -25,11 +25,9 @@ export const PresentHeader = React.memo(() => { icon={} onClick={() => { setLoading(true); - try { - forServer.slide(messageApi, messageKey); - } finally { - setLoading(false) - } + forServer + .slide(messageApi, messageKey) + .finally(() => setLoading(false)); }} className="header-cta-right" type="text" shape='round'