File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,7 @@ export default class VotingStore extends Store {
424424 const intl = i18nContext ( currentLocale ) ;
425425
426426 try {
427- await votingPDFGenerator ( {
427+ const wasSaved = await votingPDFGenerator ( {
428428 nextVotingFundNumber,
429429 qrCode,
430430 walletName,
@@ -437,7 +437,10 @@ export default class VotingStore extends Store {
437437 intl,
438438 } ) ;
439439 // @ts -ignore ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
440- this . actions . voting . saveAsPDFSuccess . trigger ( ) ;
440+
441+ if ( wasSaved ) {
442+ this . actions . voting . saveAsPDFSuccess . trigger ( ) ;
443+ }
441444 } catch ( error ) {
442445 throw new Error ( error ) ;
443446 }
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export const votingPDFGenerator = async ({
5757 network,
5858 isMainnet,
5959 intl,
60- } : Params ) => {
60+ } : Params ) : Promise < boolean > => {
6161 // Consolidate data
6262 const title = intl . formatMessage ( messages . title , {
6363 nextVotingFundNumber,
@@ -93,6 +93,11 @@ export const votingPDFGenerator = async ({
9393 } ;
9494 const dialogPath = await showSaveDialogChannel . send ( params ) ;
9595 const filePath = dialogPath . filePath || '' ;
96+
97+ if ( dialogPath . canceled || ! ! filePath ) {
98+ return false ;
99+ }
100+
96101 await generateVotingPDFChannel . send ( {
97102 title,
98103 currentLocale,
@@ -106,4 +111,6 @@ export const votingPDFGenerator = async ({
106111 filePath,
107112 author,
108113 } ) ;
114+
115+ return true ;
109116} ;
You can’t perform that action at this time.
0 commit comments