1 | const Command = require('../base')
|
2 | const renderShortDesc = require('../utils/renderShortDescription')
|
3 | const { track } = require('../utils/telemetry')
|
4 |
|
5 | class LogoutCommand extends Command {
|
6 | async run() {
|
7 | const accessToken = this.getAuthToken()
|
8 |
|
9 | if (accessToken) {
|
10 | await track('user_logout')
|
11 |
|
12 |
|
13 | this.netlify.globalConfig.set('userId', null)
|
14 |
|
15 | this.log(`Logging you out of Netlify. Come back soon!`)
|
16 |
|
17 | } else {
|
18 | this.log(`Already logged out`)
|
19 | }
|
20 | }
|
21 | }
|
22 |
|
23 | LogoutCommand.description = `${renderShortDesc('Logout of your Netlify account')}`
|
24 |
|
25 | module.exports = LogoutCommand
|