Skip to content

Commit 86fdeb5

Browse files
committed
chore: make constant for notification header
1 parent ee05343 commit 86fdeb5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/apps/app/app.element.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
extractUmbNotificationColor,
2424
isUmbNotifications,
2525
UMB_NOTIFICATION_CONTEXT,
26+
UMB_NOTIFICATION_HEADER,
2627
} from '@umbraco-cms/backoffice/notification';
2728

2829
@customElement('umb-app')
@@ -219,7 +220,7 @@ export class UmbAppElement extends UmbLitElement {
219220

220221
#attachApiInterceptor() {
221222
OpenAPI.interceptors.response.use((response) => {
222-
const umbNotifications = response.headers.get('umb-notifications');
223+
const umbNotifications = response.headers.get(UMB_NOTIFICATION_HEADER);
223224
if (!umbNotifications) return response;
224225

225226
const notifications = JSON.parse(umbNotifications);
@@ -236,7 +237,7 @@ export class UmbAppElement extends UmbLitElement {
236237
const newHeader = new Headers();
237238
for (const header of response.headers.entries()) {
238239
const [key, value] = header;
239-
if (key !== 'umb-notifications') newHeader.set(key, value);
240+
if (key !== UMB_NOTIFICATION_HEADER) newHeader.set(key, value);
240241
}
241242

242243
const newResponse = new Response(response.body, {

src/packages/core/notification/isUmbNotifications.function.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ export interface UmbNotificationsEventModel {
2222
export function isUmbNotifications(notifications: Array<unknown>): notifications is Array<UmbNotificationsEventModel> {
2323
return notifications.every(objectIsUmbNotification);
2424
}
25+
26+
export const UMB_NOTIFICATION_HEADER = 'umb-notifications';

0 commit comments

Comments
 (0)