Skip to content

Commit

Permalink
Fix issue with first-run wizard (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Mar 8, 2025
1 parent fb56414 commit da291cf
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,12 @@ export class Auth {

export async function apiGetNew(auth, endpoint) {
try {
const accessToken = await auth.getValidAccessToken()
const headers = {
Authorization: `Bearer ${accessToken}`,
}
const headers = {}
try {
const accessToken = await auth.getValidAccessToken()
headers.Authorization = `Bearer ${accessToken}`
// eslint-disable-next-line no-empty
} catch {}
const resp = await fetch(`${__APIHOST__}${endpoint}`, {
method: 'GET',
headers,
Expand Down Expand Up @@ -727,11 +729,16 @@ export async function apiPutPostDeleteNew(
{isJson = true, dbChanged = true, requireFresh = false} = {}
) {
try {
const accessToken = await auth.getValidAccessToken()
const headers = {
Accept: 'application/json',
Authorization: `Bearer ${accessToken}`,
}
let headers = {}
try {
const accessToken = await auth.getValidAccessToken()
headers = {
...headers,
Accept: 'application/json',
Authorization: `Bearer ${accessToken}`,
}
// eslint-disable-next-line no-empty
} catch {}
if (isJson) {
headers['Content-Type'] = 'application/json'
}
Expand Down

0 comments on commit da291cf

Please sign in to comment.