UNPKG

flagpole

Version:

Simple and fast DOM integration, headless or headful browser, and REST API testing framework.

52 lines 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const cli_helper_1 = require("./cli-helper"); const cli_1 = require("./cli"); const clortho_lite_1 = require("clortho-lite"); const request = require("request"); const serviceName = "Flagpole JS"; const service = new clortho_lite_1.ClorthoService(serviceName); function logout() { cli_1.Cli.hideBanner = true; cli_helper_1.printHeader(); cli_helper_1.printSubheader("Logout of FlagpoleJS.com"); cli_1.Cli.getCredentials() .then(function (credentials) { cli_1.Cli.log(""); request.delete(cli_1.Cli.apiDomain + "/api/token/" + credentials.token, { body: JSON.stringify({ token: credentials.token }), headers: { "Content-Type": "application/json" } }, function (err, response, body) { if (err) { cli_1.Cli.log(err); cli_1.Cli.log(""); cli_1.Cli.exit(1); } else { service.remove("token"); service .remove("email") .then(function (result) { cli_1.Cli.log("Logged you out of account: " + credentials.email); cli_1.Cli.log(""); cli_1.Cli.exit(0); }) .catch(function (err) { cli_1.Cli.log(err); cli_1.Cli.log(""); cli_1.Cli.exit(1); }); } }); }) .catch(function () { cli_1.Cli.log(""); cli_1.Cli.log("You were not logged in."); cli_1.Cli.log(""); cli_1.Cli.exit(0); }); } exports.logout = logout; //# sourceMappingURL=logout.js.map