diff --git a/src/interaction.ts b/src/interaction.ts index 29c9db52c..de5be4195 100644 --- a/src/interaction.ts +++ b/src/interaction.ts @@ -304,7 +304,6 @@ export default class Zoom { const scales: Record> = {}; if (extent === undefined) { throw new Error('Error--scales created before extent present.'); - return {}; } interface Scale_datum { @@ -316,8 +315,8 @@ export default class Zoom { for (const [name, dim] of [ ['x', width], ['y', height], - ]) { - const limits = extent[name]; + ] as const) { + const limits = extent[name] as [number, number]; const size_range = limits[1] - limits[0]; scale_dat[name] = { limits, diff --git a/src/tile.ts b/src/tile.ts index 7b2ec0aea..8c86d838e 100644 --- a/src/tile.ts +++ b/src/tile.ts @@ -359,7 +359,6 @@ export abstract class Tile { export class QuadTile extends Tile { url: string; - bearer_token = ''; key: string; public _children: Array = []; codes: [number, number, number]; @@ -369,13 +368,10 @@ export class QuadTile extends Tile { base_url: string, key: string, parent: QuadTile | null, - dataset: QuadtileSet, - prefs: APICall + dataset: QuadtileSet ) { super(dataset); this.url = base_url; - this.bearer_token = prefs?.bearer_token ?? ''; - this.parent = parent as this; this.key = key; const [z, x, y] = key.split('/').map((d) => Number.parseInt(d)); @@ -416,16 +412,15 @@ export class QuadTile extends Tile { let url = `${this.url}/${this.key}.feather`; this.download_state = 'In progress'; - if (this.bearer_token) { + //TODO: Atlas specific code--maybe check for nomic URL too. + if (window.localStorage.getItem('isLoggedIn') === 'true') { url = url.replace('/public', ''); } - const request: RequestInit | undefined = this.bearer_token - ? { + const request: RequestInit = { method: 'GET', - headers: { Authorization: 'Bearer ' + this.bearer_token }, - } - : undefined; + credentials: 'include', + }; this._download = fetch(url, request) .then(async (response): Promise => { @@ -489,14 +484,11 @@ export class QuadTile extends Tile { k: string, l: string, m: this, - data: typeof this.dataset, - prefs: APICall + data: typeof this.dataset ) => this; if (this._children.length < this.child_locations.length) { for (const key of this.child_locations) { - const child = new constructor(this.url, key, this, this.dataset, { - bearer_token: this.bearer_token, - }); + const child = new constructor(this.url, key, this, this.dataset); this._children.push(child); } } diff --git a/src/typing.ts b/src/typing.ts index c3cb1526c..b747487a2 100644 --- a/src/typing.ts +++ b/src/typing.ts @@ -6,10 +6,6 @@ export function isLambdaChannel(input: RootChannel): input is LambdaChannel { return (input as LambdaChannel).lambda !== undefined; } -export function isDataChannel(input: RootChannel): input is DataChannel { - return (input as DataChannel).field !== undefined; -} - export function isConstantChannel( input: RootChannel | ColorChannel ): input is ConstantChannel {