master
vampirefrog 2 years ago
parent 58184dbfe1
commit e7ab14495e

@ -24,7 +24,7 @@ class DLiveApi extends EventEmitter {
body: JSON.stringify(postData, 2)
};
this.emit('verbose', 'POST ' + fetchData.body);
this.emit('verbose', 'POST>' + fetchData.body);
if(!options || !options.noAuth) {
if(!this.authToken) {
@ -40,10 +40,11 @@ class DLiveApi extends EventEmitter {
return response.json();
})
.then((json) => {
this.emit('verbose', 'POST<' + JSON.stringify(json));
if(json.error) {
reject(new Error(JSON.stringify(json.error)));
} else if(json.errors) {
reject(new Error(json.errors[0].message));
reject(new Error(JSON.stringify(json.errors)));
} else {
if(json && json.data) {
resolve(json.data);
@ -230,9 +231,9 @@ class DLiveApi extends EventEmitter {
}
`
}).then((data) => {
this.livestreamChatroomInfoCache[displayname] = data;
this.livestreamChatroomInfoCache[displayname] = data.userByDisplayName;
resolve(data);
resolve(data.userByDisplayName);
}, (err) => {
reject(err);
});
@ -240,4 +241,4 @@ class DLiveApi extends EventEmitter {
}
}
module.exports = DLiveApi;
module.exports = DLiveApi;

Loading…
Cancel
Save