@contrail/flexplm 1.1.47 → 1.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -166,4 +166,30 @@ export class FlexPLMConnect {
|
|
|
166
166
|
async sendMultipleToFlexPLM(payload: PayloadType[]){
|
|
167
167
|
return await this.processRequest(payload);
|
|
168
168
|
}
|
|
169
|
+
|
|
170
|
+
/** Runs a get request to FlexPLM using the endpoint provided in the constructor
|
|
171
|
+
*
|
|
172
|
+
*/
|
|
173
|
+
async getRequest(){
|
|
174
|
+
const urlContext = this.config.urlContext;
|
|
175
|
+
const vibeEventsURL: string = this.config.apiHost + urlContext + '/servlet/rest' + this.vibeEventEndpoint;
|
|
176
|
+
const csrfOptions = this.getRequestOptions('GET');
|
|
177
|
+
const response = await fetch(vibeEventsURL, csrfOptions);
|
|
178
|
+
|
|
179
|
+
if(response.status >= 300){
|
|
180
|
+
const message = 'Error connecting to FlexPLM:status: ' + response.status;
|
|
181
|
+
console.error(message);
|
|
182
|
+
console.error(await response.text());
|
|
183
|
+
throw new Error(message);
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
const data = await response.json();
|
|
187
|
+
return data;
|
|
188
|
+
} catch(e){
|
|
189
|
+
const message = 'Error getting json data from FlexPLM: ' + e.message;
|
|
190
|
+
console.error(message);
|
|
191
|
+
console.error(await response.text());
|
|
192
|
+
throw new Error(message);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
169
195
|
}
|