ryuu
Version:
Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo
38 lines • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Session = void 0;
// import {AxiosRequestConfig} from 'axios';
const log_1 = require("./log");
class Session {
static check(domo) {
return new Promise((resolve, reject) => {
const options = {
url: 'https://' + domo.getInstance() + '/auth/validate',
method: 'GET',
};
domo
.processRequest(options)
.then((res) => {
try {
if (res.isValid) {
resolve(true);
}
else {
reject(false);
}
}
catch {
// couldn't parse as JSON which means the service doesn't exist yet.
// TODO: remove this once the /domoweb/auth/validate service has shipped to prod
resolve(true);
}
})
.catch(err => {
log_1.log.clientRequestFailed(err.statusCode + ' - ' + err.message, err.failureMessage);
reject(false);
});
});
}
}
exports.Session = Session;
//# sourceMappingURL=session.js.map