Class: Vkit::CLI::Commands::LogoutCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/vkit/cli/commands/logout_command.rb

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vkit/cli/commands/logout_command.rb', line 5

def call
  token = credential_store.token

  if token
    begin
      client = Vkit::Core::AuthClient.new(
        base_url: credential_store.endpoint
      )

      client.logout(token)
    rescue => e
      warn "⚠️ Server logout failed: #{e.message}"
      warn "⚠️ Continuing with local logout"
    end
  end

  credential_store.clear_token!
  puts "🧹 Logged out"
end