@@ -38,6 +38,7 @@ import { DeleteDocumentAction } from '../../show/components/DeleteDocumentAction
3838import { RestoreDocumentAction } from '../../show/components/RestoreDocumentAction' ;
3939import { SendInvitationsModal } from '../../show/components/SendInvitationsModal' ;
4040import { CloneAction } from '../components/CloneAction' ;
41+ import { toastDownloadError } from '../helpers' ;
4142import { MakeTemplateAction } from '../components/MakeTemplateAction' ;
4243import { VoidAction } from '../components/VoidAction' ;
4344
@@ -81,15 +82,7 @@ export function useActions(params?: Params) {
8182 downloadBlob ( response . data , filename , 'application/pdf' ) ;
8283 toast . dismiss ( ) ;
8384 } )
84- . catch ( ( error ) => {
85- if ( error . response ?. status === 422 ) {
86- toast . error ( error . response . data . message || 'something_went_wrong' ) ;
87- } else if ( error . response ?. status === 400 ) {
88- toast . error ( 'not_ready_for_download' ) ;
89- } else {
90- toast . error ( 'something_went_wrong' ) ;
91- }
92- } ) ;
85+ . catch ( toastDownloadError ) ;
9386 } ;
9487
9588 const downloadAuditLog = ( doc : Document ) => {
@@ -117,15 +110,7 @@ export function useActions(params?: Params) {
117110 downloadBlob ( response . data , filename , 'application/pdf' ) ;
118111 toast . dismiss ( ) ;
119112 } )
120- . catch ( ( error ) => {
121- if ( error . response ?. status === 422 ) {
122- toast . error ( error . response . data . message || 'something_went_wrong' ) ;
123- } else if ( error . response ?. status === 400 ) {
124- toast . error ( 'not_ready_for_download' ) ;
125- } else {
126- toast . error ( 'something_went_wrong' ) ;
127- }
128- } ) ;
113+ . catch ( toastDownloadError ) ;
129114 } ;
130115
131116 const getUserInvitation = ( doc : Document ) => {
0 commit comments