@pnp/cli-microsoft365
Version:
Manage Microsoft 365 and SharePoint Framework projects on any platform
40 lines • 1.12 kB
JavaScript
import auth from '../../Auth.js';
import Command, { CommandError } from '../../Command.js';
import commands from './commands.js';
class LogoutCommand extends Command {
get name() {
return commands.LOGOUT;
}
get description() {
return 'Log out from Microsoft 365';
}
async commandAction(logger) {
if (this.verbose) {
await logger.logToStderr('Logging out from Microsoft 365...');
}
const deactivate = () => auth.connection.deactivate();
try {
await auth.clearConnectionInfo();
}
catch (error) {
if (this.debug) {
await logger.logToStderr(new CommandError(error));
}
}
finally {
deactivate();
}
}
async action(logger, args) {
try {
await auth.restoreAuth();
}
catch (error) {
throw new CommandError(error);
}
await this.initAction(args, logger);
await this.commandAction(logger);
}
}
export default new LogoutCommand();
//# sourceMappingURL=logout.js.map