diff --git a/src/pages/create/index.tsx b/src/pages/create/index.tsx index 29bca5e..e51a9d9 100644 --- a/src/pages/create/index.tsx +++ b/src/pages/create/index.tsx @@ -788,24 +788,13 @@ export const CreatePage = () => { setLoadingSpinnerDesc('Sending notifications to counterparties') const notifications = await Promise.allSettled(sendNotifications(meta)) if (notifications.every(isPromiseFulfilled)) { - toast.success('finished processing notifications!') + toast.success('Notifications sent successfully') } else { - notifications - .filter(isPromiseRejected) - .map((res: PromiseRejectedResult) => res.reason) - .forEach((res) => console.log('rejected result: ', res)) + logRejectedNotifications(notifications) + toast.error( + 'Some notifications failed to publish. Please rebroadcast them again.' + ) } - - // const promises = sendNotifications(meta) - - // await Promise.all(promises) - // .then(() => { - // toast.success('Notifications sent successfully') - // }) - // .catch(() => { - // toast.error('Failed to publish notifications') - // }) - navigate(appPrivateRoutes.sign, { state: { meta: meta } }) } else { const zip = new JSZip() @@ -861,6 +850,15 @@ export const CreatePage = () => { } } + const logRejectedNotifications = ( + notifications: PromiseSettledResult[] + ) => { + notifications + .filter(isPromiseRejected) + .map((res: PromiseRejectedResult) => (res.reason as Error).message) + .forEach((message: string) => console.log(message)) + } + const onDrawFieldsChange = (sigitFiles: SigitFile[]) => { setDrawnFiles(sigitFiles) }