@@ -60,18 +60,10 @@ const MediaLibraryPage = () => {
60
60
data : assetData ,
61
61
} ;
62
62
63
- interface AxiosResponse < T > {
64
- data : T ;
65
- status : number ;
66
- statusText : string ;
67
- headers : Record < string , string > ;
68
- }
69
-
70
- const response = ( await http . post ( '/webhook' , payload ) ) as AxiosResponse < WebhookResponse > ;
71
- const data = response . data ;
63
+ const response = await http . post < WebhookPayload , WebhookResponse > ( '/webhook' , payload ) ;
72
64
73
- if ( data ?. status === 'success' ) {
74
- const stats = data . stats || { successful : 0 , total : 0 , failed : 0 } ;
65
+ if ( response ?. status === 'success' ) {
66
+ const stats = response . stats || { successful : 0 , total : 0 , failed : 0 } ;
75
67
76
68
toggleNotification ( {
77
69
type : 'success' ,
@@ -83,18 +75,15 @@ const MediaLibraryPage = () => {
83
75
{ successful : stats . successful , total : stats . total }
84
76
) ,
85
77
} ) ;
86
-
87
- if ( stats . successful > 0 ) {
88
- }
89
- } else if ( data ?. status === 'warning' ) {
78
+ } else if ( response ?. status === 'warning' ) {
90
79
toggleNotification ( {
91
80
type : 'warning' ,
92
81
message : formatMessage (
93
82
{
94
83
id : `${ camelCase ( PLUGIN_ID ) } .page.mediaLibrary.notification.import.warning` ,
95
84
defaultMessage : 'Import completed with warnings: {message}' ,
96
85
} ,
97
- { message : data . message || 'Some files may not have been imported' }
86
+ { message : response . message || 'Some files may not have been imported' }
98
87
) ,
99
88
} ) ;
100
89
} else {
0 commit comments