()
| 19 | * notify('Post renamed', { type: 'info', undoable: true }) |
| 20 | */ |
| 21 | export const useNotify = () => { |
| 22 | const addNotification = useAddNotificationContext(); |
| 23 | return useCallback( |
| 24 | ( |
| 25 | message: string | ReactNode, |
| 26 | options: NotificationOptions & { type?: NotificationType } = {} |
| 27 | ) => { |
| 28 | const { type: messageType = 'info', ...notificationOptions } = |
| 29 | options; |
| 30 | addNotification({ |
| 31 | message, |
| 32 | type: messageType, |
| 33 | notificationOptions, |
| 34 | }); |
| 35 | }, |
| 36 | [addNotification] |
| 37 | ); |
| 38 | }; |