Skip to content

Commit a1c3fbd

Browse files
committed
refactor: use correct global config type and handle it
1 parent 87d8c53 commit a1c3fbd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/commands/status/status.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ import type BaseCommand from '../base-command.js'
1616

1717
export const status = async (options: OptionValues, command: BaseCommand) => {
1818
const { accounts, api, globalConfig, site, siteInfo } = command.netlify
19-
const current = globalConfig.get('userId') as string
19+
const currentUserId = globalConfig.get('userId') as string | undefined
2020
const [accessToken] = await getToken()
2121

2222
if (!accessToken) {
2323
log(`Not logged in. Please log in to see site status.`)
2424
log()
2525
log('Login with "netlify login" command')
26-
exit()
26+
return exit()
2727
}
2828

2929
const siteId = site.id
@@ -46,7 +46,10 @@ export const status = async (options: OptionValues, command: BaseCommand) => {
4646
}
4747
}
4848

49-
const ghuser = command.netlify.globalConfig.get(`users.${current}.auth.github.user`) as string
49+
const ghuser =
50+
currentUserId != null
51+
? (globalConfig.get(`users.${currentUserId}.auth.github.user`) as string | undefined)
52+
: undefined
5053
const accountData = {
5154
Name: user.full_name,
5255
Email: user.email,

0 commit comments

Comments
 (0)