Skip to content

Commit

Permalink
Change state for present button
Browse files Browse the repository at this point in the history
  • Loading branch information
ducquando committed Apr 28, 2024
1 parent 88579d9 commit 9cc981d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
17 changes: 10 additions & 7 deletions src/wireframes/components/actions/use-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export function useServer() {
duration: 1,
});
}
return;
}

const fetchSlide = async (messageApi: MessageInstance, messageKey: string) => {
Expand All @@ -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 };
Expand Down
8 changes: 3 additions & 5 deletions src/wireframes/components/headers/PresentHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ export const PresentHeader = React.memo(() => {
icon={<FundProjectionScreenOutlined />}
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'
Expand Down

0 comments on commit 9cc981d

Please sign in to comment.