Skip to content

Commit

Permalink
chore: use Object
Browse files Browse the repository at this point in the history
  • Loading branch information
SaarChaffee committed Mar 3, 2024
1 parent 584b1f7 commit 0651a26
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/pixiv/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,23 @@ class PixivImageSource extends ImageSource<PixivImageSource.Config> {
const endpoint = 'https://oauth.secure.pixiv.net/' // OAuth Endpoint
const url = trimSlash(endpoint) + '/auth/token'

const urlencoded = new URLSearchParams()
urlencoded.append('get_secure_url', 'true')
urlencoded.append('client_id', CLIENT_ID)
urlencoded.append('client_secret', CLIENT_SECRET)
urlencoded.append('grant_type', 'refresh_token')
urlencoded.append('refresh_token', this.refreshToken)
const data = new URLSearchParams({
get_secure_url: 'true',
client_id: CLIENT_ID,
client_secret: CLIENT_SECRET,
grant_type: 'refresh_token',
refresh_token: this.refreshToken,
})

const resp = await this.ctx.http(url,
{
method: 'POST',
data,
headers: {
...this._getHeaders(),
'Content-Type': 'application/x-www-form-urlencoded',
'host': 'oauth.secure.pixiv.net',
},
data: urlencoded,
validateStatus: () => true,
}
)
Expand Down

0 comments on commit 0651a26

Please sign in to comment.