Skip to content

Commit

Permalink
chore(format): fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnAlbin committed Jan 29, 2024
1 parent 307df96 commit 61f723b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
15 changes: 6 additions & 9 deletions packages/next-drupal/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ export class DrupalClient {
this.tokenExpiresOn = Date.now() + token.expires_in * 1000
}

/* eslint-disable @typescript-eslint/no-explicit-any */
async fetch(input: RequestInfo, init?: FetchOptions): Promise<Response> {
init = {
...init,
Expand Down Expand Up @@ -268,9 +267,8 @@ export class DrupalClient {
init["headers"]["Authorization"] = `Bearer ${token.access_token}`
}
} else if (isAccessTokenAuth(this._auth)) {
init["headers"][
"Authorization"
] = `${this._auth.token_type} ${this._auth.access_token}`
init["headers"]["Authorization"] =
`${this._auth.token_type} ${this._auth.access_token}`
}
}
} else if (typeof init.withAuth === "string") {
Expand All @@ -297,9 +295,8 @@ export class DrupalClient {
init["headers"]["Authorization"] = `Bearer ${token.access_token}`
}
} else if (isAccessTokenAuth(init.withAuth)) {
init["headers"][
"Authorization"
] = `${init.withAuth.token_type} ${init.withAuth.access_token}`
init["headers"]["Authorization"] =
`${init.withAuth.token_type} ${init.withAuth.access_token}`
}
}

Expand Down Expand Up @@ -1419,8 +1416,8 @@ export class DrupalClient {
}

// Error handling.
// If throwErrors is enable, we show errors in the Next.js overlay.
// Otherwise we log the errors even if debugging is turned off.
// If throwErrors is enabled, we show errors in the Next.js overlay.
// Otherwise, we log the errors even if debugging is turned off.
// In production, errors are always logged never thrown.
private throwError(error: Error) {
if (!this.throwJsonApiErrors) {
Expand Down
9 changes: 4 additions & 5 deletions packages/next-drupal/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ export async function buildHeaders({
// This reduces the number of OAuth call to the Drupal server.
// Intentionally marked as unstable for now.
if (process.env.UNSTABLE_DRUPAL_ACCESS_TOKEN) {
headers[
"Authorization"
] = `Bearer ${process.env.UNSTABLE_DRUPAL_ACCESS_TOKEN}`
headers["Authorization"] =
`Bearer ${process.env.UNSTABLE_DRUPAL_ACCESS_TOKEN}`

return headers
}
Expand Down Expand Up @@ -122,8 +121,8 @@ export function getPathFromContext(
return !slug
? process.env.DRUPAL_FRONT_PAGE
: prefix
? `${prefix}/${slug}`
: slug
? `${prefix}/${slug}`
: slug
}

export function syncDrupalPreviewRoutes(path) {
Expand Down

0 comments on commit 61f723b

Please sign in to comment.