Bugfixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
exports.__esModule = true;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MoorenTV = void 0;
|
||||
var axios_1 = require("axios");
|
||||
var MoorenTV = /** @class */ (function () {
|
||||
@@ -8,46 +8,46 @@ var MoorenTV = /** @class */ (function () {
|
||||
this.adminPass = settings.adminPass;
|
||||
}
|
||||
MoorenTV.prototype._getBaseURI = function () {
|
||||
return "http://" + this.serverAddress + ":" + this.serverPort + "/api/v1/" + this.adminPass + "/";
|
||||
return "http://".concat(this.serverAddress, ":").concat(this.serverPort, "/api/v1/").concat(this.adminPass, "/");
|
||||
};
|
||||
MoorenTV.prototype.ping = function (callback) {
|
||||
axios_1["default"].get(this._getBaseURI() + "ping").then(function () {
|
||||
axios_1.default.get(this._getBaseURI() + "ping").then(function () {
|
||||
callback(true);
|
||||
})["catch"](function () {
|
||||
}).catch(function () {
|
||||
callback(false);
|
||||
});
|
||||
};
|
||||
MoorenTV.prototype.getGames = function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios_1["default"].get(_this._getBaseURI() + 'games').then(function (response) {
|
||||
axios_1.default.get(_this._getBaseURI() + 'games').then(function (response) {
|
||||
if (response.data.succeed == true)
|
||||
resolve(response.data.response);
|
||||
else
|
||||
reject('Internal server error');
|
||||
})["catch"](reject);
|
||||
}).catch(reject);
|
||||
});
|
||||
};
|
||||
MoorenTV.prototype.startGame = function (gameID) {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios_1["default"].get(_this._getBaseURI() + "games/start/" + gameID).then(function (response) {
|
||||
axios_1.default.get(_this._getBaseURI() + "games/start/" + gameID).then(function (response) {
|
||||
if (response.data.succeed == true)
|
||||
resolve();
|
||||
else
|
||||
reject();
|
||||
})["catch"](reject);
|
||||
}).catch(reject);
|
||||
});
|
||||
};
|
||||
MoorenTV.prototype.stopGame = function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios_1["default"].get(_this._getBaseURI() + "games/stop").then(function (response) {
|
||||
axios_1.default.get(_this._getBaseURI() + "games/stop").then(function (response) {
|
||||
if (response.data.succeed == true)
|
||||
resolve();
|
||||
else
|
||||
reject();
|
||||
})["catch"](reject);
|
||||
}).catch(reject);
|
||||
});
|
||||
};
|
||||
return MoorenTV;
|
||||
|
||||
Reference in New Issue
Block a user