Skip to content

Commit

Permalink
use accessToken in listDatasets (#1064)
Browse files Browse the repository at this point in the history
fix #1063
  • Loading branch information
severo authored Dec 5, 2024
1 parent 5a83944 commit 2b4643f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/hub/src/lib/file-download-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function fileDownloadInfo(
const resp = await (params.fetch ?? fetch)(url, {
method: "GET",
headers: {
...(params.credentials && {
...(accessToken && {
Authorization: `Bearer ${accessToken}`,
}),
Range: "bytes=0-0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/lib/list-datasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function* listDatasets<
const res: Response = await (params?.fetch ?? fetch)(url, {
headers: {
accept: "application/json",
...(params?.credentials ? { Authorization: `Bearer ${accessToken}` } : undefined),
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined),
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/lib/list-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export async function* listModels<
const res: Response = await (params?.fetch ?? fetch)(url, {
headers: {
accept: "application/json",
...(params?.credentials ? { Authorization: `Bearer ${accessToken}` } : undefined),
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined),
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/lib/list-spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function* listSpaces<
const res: Response = await (params?.fetch ?? fetch)(url, {
headers: {
accept: "application/json",
...(params?.credentials ? { Authorization: `Bearer ${accessToken}` } : undefined),
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined),
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/lib/paths-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function pathsInfo(
const resp = await (params.fetch ?? fetch)(url, {
method: "POST",
headers: {
...(params.credentials && {
...(accessToken && {
Authorization: `Bearer ${accessToken}`,
}),
Accept: "application/json",
Expand Down

0 comments on commit 2b4643f

Please sign in to comment.