ryuu
Version:
Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo
33 lines • 1.11 kB
JavaScript
import { log } from './log.js';
export 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.clientRequestFailed(err.statusCode + ' - ' + err.message, err.failureMessage);
reject(false);
});
});
}
}
//# sourceMappingURL=session.js.map