@@ -218,27 +218,33 @@ export class UmbAppElement extends UmbLitElement {
218
218
}
219
219
220
220
#attachApiInterceptor( ) {
221
- OpenAPI . interceptors . response . use ( async ( response ) => {
222
- const umbNotifications = response . headers . get ( 'umb-notifications' ) as string | null ;
221
+ OpenAPI . interceptors . response . use ( ( response ) => {
222
+ const umbNotifications = response . headers . get ( 'umb-notifications' ) ;
223
223
if ( ! umbNotifications ) return response ;
224
224
225
225
const notifications = JSON . parse ( umbNotifications ) ;
226
226
if ( ! isUmbNotifications ( notifications ) ) return response ;
227
227
228
- const notificationContext = await this . getContext ( UMB_NOTIFICATION_CONTEXT ) ;
229
- for ( const notification of notifications ) {
230
- notificationContext . peek ( extractUmbNotificationColor ( notification . type ) , {
231
- data : { headline : notification . category , message : notification . message } ,
232
- } ) ;
233
- }
228
+ this . getContext ( UMB_NOTIFICATION_CONTEXT ) . then ( ( notificationContext ) => {
229
+ for ( const notification of notifications ) {
230
+ notificationContext . peek ( extractUmbNotificationColor ( notification . type ) , {
231
+ data : { headline : notification . category , message : notification . message } ,
232
+ } ) ;
233
+ }
234
+ } ) ;
234
235
235
236
const newHeader = new Headers ( ) ;
236
237
for ( const header of response . headers . entries ( ) ) {
237
238
const [ key , value ] = header ;
238
239
if ( key !== 'umb-notifications' ) newHeader . set ( key , value ) ;
239
240
}
240
241
241
- const newResponse = { ...response , headers : newHeader } ;
242
+ const newResponse = new Response ( response . body , {
243
+ headers : newHeader ,
244
+ status : response . status ,
245
+ statusText : response . statusText ,
246
+ } ) ;
247
+
242
248
return newResponse ;
243
249
} ) ;
244
250
}
0 commit comments