11import terminalLink from 'terminal-link'
22
33import { confirm , password , select } from '@socketsecurity/registry/lib/prompts'
4- import { Spinner } from '@socketsecurity/registry/lib/spinner'
54
65import { applyLogin } from './apply-login'
76import constants from '../../constants'
@@ -28,18 +27,17 @@ export async function attemptLogin(
2827 apiBaseUrl : string | undefined ,
2928 apiProxy : string | undefined
3029) {
30+ apiBaseUrl ??= getSetting ( 'apiBaseUrl' ) ?? undefined
31+ apiProxy ??= getSetting ( 'apiProxy' ) ?? undefined
3132 const apiToken =
3233 ( await password ( {
3334 message : `Enter your ${ terminalLink (
3435 'Socket.dev API key' ,
3536 'https://docs.socket.dev/docs/api-keys'
3637 ) } (leave blank for a public key)`
3738 } ) ) || SOCKET_PUBLIC_API_TOKEN
38-
39- apiBaseUrl ??= getSetting ( 'apiBaseUrl' ) ?? undefined
40- apiProxy ??= getSetting ( 'apiProxy' ) ?? undefined
41-
42- const spinner = new Spinner ( )
39+ // Lazily access constants.spinner.
40+ const { spinner } = constants
4341
4442 spinner . start ( 'Verifying API key...' )
4543
@@ -65,7 +63,6 @@ export async function attemptLogin(
6563 } ) )
6664
6765 let enforcedOrgs : Array < string > = [ ]
68-
6966 if ( enforcedChoices . length > 1 ) {
7067 const id = < string | null > await select (
7168 {
0 commit comments