Skip to content

Commit

Permalink
refactor(wordpress): prefer .json() over responseType: json
Browse files Browse the repository at this point in the history
  • Loading branch information
mtthp committed May 15, 2024
1 parent fbc2b1d commit cc9e459
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/util/wordpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ export async function getOrders(year) {
}

export async function getUser(userId) {
const response = await got(`${WORDPRESS_BASE_URL}/api-json-wp/wp/v2/users/${userId}?context=edit`, {
responseType: 'json', // Prefer over `.json()` to parse JSON response
const user = await got(`${WORDPRESS_BASE_URL}/api-json-wp/wp/v2/users/${userId}?context=edit`, {
username: process.env.WP_APIV2_USERNAME,
password: process.env.WP_APIV2_PASSWORD
})
}).json()

return response.body
return user
}

export function getUserFromOAuthAccessToken(accessToken) {
Expand Down

0 comments on commit cc9e459

Please sign in to comment.