refactor: logs npubs for failed notifications
This commit is contained in:
parent
de7a8a868a
commit
9cefdad3fc
@ -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<string[]>[]
|
||||
) => {
|
||||
notifications
|
||||
.filter(isPromiseRejected)
|
||||
.map((res: PromiseRejectedResult) => (res.reason as Error).message)
|
||||
.forEach((message: string) => console.log(message))
|
||||
}
|
||||
|
||||
const onDrawFieldsChange = (sigitFiles: SigitFile[]) => {
|
||||
setDrawnFiles(sigitFiles)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user