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')
|
setLoadingSpinnerDesc('Sending notifications to counterparties')
|
||||||
const notifications = await Promise.allSettled(sendNotifications(meta))
|
const notifications = await Promise.allSettled(sendNotifications(meta))
|
||||||
if (notifications.every(isPromiseFulfilled)) {
|
if (notifications.every(isPromiseFulfilled)) {
|
||||||
toast.success('finished processing notifications!')
|
toast.success('Notifications sent successfully')
|
||||||
} else {
|
} else {
|
||||||
notifications
|
logRejectedNotifications(notifications)
|
||||||
.filter(isPromiseRejected)
|
toast.error(
|
||||||
.map((res: PromiseRejectedResult) => res.reason)
|
'Some notifications failed to publish. Please rebroadcast them again.'
|
||||||
.forEach((res) => console.log('rejected result: ', res))
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 } })
|
navigate(appPrivateRoutes.sign, { state: { meta: meta } })
|
||||||
} else {
|
} else {
|
||||||
const zip = new JSZip()
|
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[]) => {
|
const onDrawFieldsChange = (sigitFiles: SigitFile[]) => {
|
||||||
setDrawnFiles(sigitFiles)
|
setDrawnFiles(sigitFiles)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user