Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public updateApi() {
this.loading = true;
let headers = new Headers({ 'Content-Type': 'application/json' });
let httpOptions = new RequestOptions({ headers: headers });
var editor = ace.edit("specEditor");
this.http.put(this.baseUrl + this.info.links.remoteApis + "/" + this.api.id, editor.getValue(), httpOptions)
.subscribe(
success => {
this.loading = false;
},
error => {
this.alertMessage = JSON.parse(error._body).error
this.alert = true;
this.loading = false;
});
}
public sendEvent() {
this.loading = true;
let headers = new Headers({ 'Content-Type': 'application/json' });
let httpOptions = new RequestOptions({ headers: headers });
var editor = ace.edit("eventTopicEditor");
let eventTime = new Date().toISOString();
let eventType = this.topicName;
var version;
var regex = /^(.*)\.([v|V][0-9]+$)/;
if (eventType.match(regex)) {
var matchedGroups = regex.exec(eventType);
version = matchedGroups[2];
eventType = matchedGroups[1];
}
else {
version = this.event.events.spec.info.version;
}
try {
let eventData = {
"event-type": eventType,
"event-type-version": version, //event types normally end with .v1
mounted: function () {
if (this.req.content === undefined || this.req.content === null) {
this.req.content = ''
}
this.editor = ace.edit('editor', {
maxLines: Infinity,
minLines: 20,
value: this.req.content,
showPrintMargin: false,
readOnly: this.req.type === 'textImmutable',
theme: 'ace/theme/chrome',
mode: modelist.getModeForPath(this.req.name).mode,
wrap: true
})
},
methods: {