Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/utils/api.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* Only import auth at runtime, not at build time
*/
async function getAuthToken(): Promise<string | undefined> {
if (typeof window === 'undefined') {

Check warning on line 42 in src/api/utils/api.utils.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis.window` over `window`.

See more on https://sonarcloud.io/project/issues?id=UKHSA-Internal_winter-pressures-frontend&issues=AZ0aIuR1a_RYW7jlTTgp&open=AZ0aIuR1a_RYW7jlTTgp&pullRequest=879
try {
const { auth } = await import('@/auth')
const session = await auth()
Expand Down Expand Up @@ -100,7 +100,7 @@
...customConfig.headers,
//passing authorization header only if access token is available, to avoid sending
// "Authorization: Bearer undefined" in the headers which might cause issues with some APIs
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
...(accessToken ? { 'X-UHD-AUTH': `Bearer ${accessToken}` } : {}),
},
}

Expand Down
Loading