fix: GitHub API response is in snake case

This commit is contained in:
EnixCoda 2021-01-31 23:05:51 +08:00
parent 1e9904ff10
commit c8ffcc3090
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -19,7 +19,7 @@ async function oauth(code: string) {
})
const body = await res.json()
const { accessToken, scope, error_description: errorDescription } = body
const { access_token: accessToken, scope, error_description: errorDescription } = body
if (errorDescription) {
throw new Error(errorDescription)
} else if (scope !== 'repo' || !accessToken || !(typeof accessToken === 'string')) {