@@ -49,8 +49,14 @@ export async function createFullScan({
49
49
} ) : Promise < void > {
50
50
// Lazily access constants.spinner.
51
51
const { spinner } = constants
52
- const socketSdk = await setupSdk ( )
53
- const supportedFiles = await socketSdk
52
+
53
+ // We're going to need an api token to suggest data because those suggestions
54
+ // must come from data we already know. Don't error on missing api token yet.
55
+ // If the api-token is not set, ignore it for the sake of suggestions.
56
+ const apiToken = getDefaultToken ( )
57
+
58
+ const sockSdk = await setupSdk ( apiToken )
59
+ const supportedFiles = await sockSdk
54
60
. getReportSupportedFiles ( )
55
61
. then ( res => {
56
62
if ( ! res . success ) {
@@ -88,25 +94,22 @@ export async function createFullScan({
88
94
// socketConfig
89
95
)
90
96
91
- // We're going to need an api token to suggest data because those suggestions
92
- // must come from data we already know. Don't error on missing api token yet.
93
- // If the api-token is not set, ignore it for the sake of suggestions.
94
- const apiToken = getDefaultToken ( )
95
-
96
97
// If the current cwd is unknown and is used as a repo slug anyways, we will
97
98
// first need to register the slug before we can use it.
98
99
let repoDefaultBranch = ''
99
100
100
101
if ( apiToken ) {
101
102
if ( ! orgSlug ) {
102
- const suggestion = await suggestOrgSlug ( socketSdk )
103
- if ( suggestion ) orgSlug = suggestion
103
+ const suggestion = await suggestOrgSlug ( sockSdk )
104
+ if ( suggestion ) {
105
+ orgSlug = suggestion
106
+ }
104
107
updatedInput = true
105
108
}
106
109
107
110
// (Don't bother asking for the rest if we didn't get an org slug above)
108
111
if ( orgSlug && ! repoName ) {
109
- const suggestion = await suggestRepoSlug ( socketSdk , orgSlug )
112
+ const suggestion = await suggestRepoSlug ( sockSdk , orgSlug )
110
113
if ( suggestion ) {
111
114
repoDefaultBranch = suggestion . defaultBranch
112
115
repoName = suggestion . slug
@@ -117,7 +120,9 @@ export async function createFullScan({
117
120
// (Don't bother asking for the rest if we didn't get an org/repo above)
118
121
if ( orgSlug && repoName && ! branchName ) {
119
122
const suggestion = await suggestBranchSlug ( repoDefaultBranch )
120
- if ( suggestion ) branchName = suggestion
123
+ if ( suggestion ) {
124
+ branchName = suggestion
125
+ }
121
126
updatedInput = true
122
127
}
123
128
}
@@ -180,7 +185,7 @@ export async function createFullScan({
180
185
spinner . start ( `Creating a scan with ${ packagePaths . length } packages...` )
181
186
182
187
const result = await handleApiCall (
183
- socketSdk . createOrgFullScan (
188
+ sockSdk . createOrgFullScan (
184
189
orgSlug ,
185
190
{
186
191
repo : repoName ,
0 commit comments