Skip to content

Commit

Permalink
fix(3d-tiles): getIonAssetMetadata struct changed (options.url) (#3128)
Browse files Browse the repository at this point in the history
  • Loading branch information
techtruth authored Oct 11, 2024
1 parent 15f97d1 commit 7dc0374
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/3d-tiles/src/lib/ion/ion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ export async function getIonTilesetMetadata(accessToken, assetId) {

// Step 2: Query metdatadata for this asset.
const ionAssetMetadata = await getIonAssetMetadata(accessToken, assetId);
const {type, url} = ionAssetMetadata;
const type = ionAssetMetadata.type;
// As of Oct 2024 ion service now returns the resource URL in an options object
const url = ionAssetMetadata.options?.url || ionAssetMetadata.url;
assert(type === '3DTILES' && url);

// Prepare a headers object for fetch
ionAssetMetadata.headers = {
Authorization: `Bearer ${ionAssetMetadata.accessToken}`
// Use provided accessToken if a new token is not provided in the ion response
Authorization: `Bearer ${ionAssetMetadata.accessToken || accessToken}`
};
return ionAssetMetadata;
}
Expand Down

0 comments on commit 7dc0374

Please sign in to comment.