1
- const { executeHttpRequest, buildCsrfHeaders } = require ( "@sap-cloud-sdk/core" ) ;
2
- const { getNotificationDestination, doesKeyExist, getPrefix, getNotificationTypesKeyWithPrefix } = require ( "./utils" ) ;
1
+ const { executeHttpRequest } = require ( "@sap-cloud-sdk/http-client" ) ;
2
+ const { buildHeadersForDestination } = require ( "@sap-cloud-sdk/connectivity" ) ;
3
+ const { getNotificationDestination, doesKeyExist, getPrefix, getNotificationTypesKeyWithPrefix, executeRequest } = require ( "./utils" ) ;
3
4
const _ = require ( "lodash" ) ;
4
5
5
6
const NOTIFICATION_TYPES_API_ENDPOINT = "v2/NotificationType.svc" ;
@@ -68,7 +69,7 @@ async function getNotificationTypes() {
68
69
69
70
async function createNotificationType ( notificationType ) {
70
71
const notificationDestination = await getNotificationDestination ( ) ;
71
- const csrfHeaders = await buildCsrfHeaders ( notificationDestination , {
72
+ const csrfHeaders = await buildHeadersForDestination ( notificationDestination , {
72
73
url : NOTIFICATION_TYPES_API_ENDPOINT ,
73
74
} ) ;
74
75
@@ -87,7 +88,7 @@ async function createNotificationType(notificationType) {
87
88
88
89
async function updateNotificationType ( id , notificationType ) {
89
90
const notificationDestination = await getNotificationDestination ( ) ;
90
- const csrfHeaders = await buildCsrfHeaders ( notificationDestination , {
91
+ const csrfHeaders = await buildHeadersForDestination ( notificationDestination , {
91
92
url : NOTIFICATION_TYPES_API_ENDPOINT ,
92
93
} ) ;
93
94
@@ -106,7 +107,7 @@ async function updateNotificationType(id, notificationType) {
106
107
107
108
async function deleteNotificationType ( notificationType ) {
108
109
const notificationDestination = await getNotificationDestination ( ) ;
109
- const csrfHeaders = await buildCsrfHeaders ( notificationDestination , {
110
+ const csrfHeaders = await buildHeadersForDestination ( notificationDestination , {
110
111
url : NOTIFICATION_TYPES_API_ENDPOINT ,
111
112
} ) ;
112
113
@@ -123,6 +124,10 @@ async function deleteNotificationType(notificationType) {
123
124
}
124
125
125
126
function _createChannelsMap ( channels ) {
127
+ if ( channels === null || channels === undefined ) {
128
+ return { } ;
129
+ }
130
+
126
131
const channelMap = { } ;
127
132
128
133
channels . forEach ( ( channel ) => {
0 commit comments