diff --git a/src/uploadx/src/interfaces.ts b/src/uploadx/src/interfaces.ts index e775e499..6a28863c 100644 --- a/src/uploadx/src/interfaces.ts +++ b/src/uploadx/src/interfaces.ts @@ -48,7 +48,7 @@ export interface UploadState { speed: number; status: UploadStatus; uploadId: string; - URI: string; + url: string; } export interface UploadItem { @@ -58,12 +58,6 @@ export interface UploadItem { * @defaultValue '/upload' */ endpoint?: string; - /** - * URL to create new uploads. - * @defaultValue '/upload' - * @deprecated Use {@link UploadItem.endpoint} instead. - */ - url?: string; /** * Headers to be appended to each HTTP request */ diff --git a/src/uploadx/src/uploader.ts b/src/uploadx/src/uploader.ts index 8c3f5922..4d4ce587 100644 --- a/src/uploadx/src/uploader.ts +++ b/src/uploadx/src/uploader.ts @@ -21,7 +21,7 @@ export abstract class Uploader { return; } (s === 'cancelled' || s === 'paused') && this.abort(); - s === 'cancelled' && this.URI && this.onCancel(); + s === 'cancelled' && this.url && this.onCancel(); this._status = s; this.notifyState(); @@ -87,7 +87,7 @@ export abstract class Uploader { /** * File URI */ - URI: string; + url: string; /** * Custom headers */ @@ -181,7 +181,7 @@ export abstract class Uploader { this.status = 'uploading'; try { await this.refreshToken(); - this.URI = await this.getFileURI(); + this.url = await this.getFileUrl(); this.retry.reset(); this.startTime = new Date().getTime(); this.start(); @@ -199,7 +199,7 @@ export abstract class Uploader { /** * Get file URI */ - protected abstract getFileURI(): Promise; + protected abstract getFileUrl(): Promise; /** * Send file content */ @@ -225,7 +225,7 @@ export abstract class Uploader { speed: this.speed, status: this.status, uploadId: this.uploadId, - URI: this.URI + url: this.url }; this.stateChange(state); @@ -329,7 +329,7 @@ export abstract class Uploader { }): Promise { return new Promise((resolve, reject) => { const xhr: XMLHttpRequest = new XMLHttpRequest(); - xhr.open(method, url || this.URI, true); + xhr.open(method, url || this.url, true); if (progress && body) { xhr.upload.onprogress = this.onProgress((body as any).size); } diff --git a/src/uploadx/src/uploaderx.ts b/src/uploadx/src/uploaderx.ts index b9916e1f..4d20eb5a 100644 --- a/src/uploadx/src/uploaderx.ts +++ b/src/uploadx/src/uploaderx.ts @@ -12,7 +12,7 @@ export class UploaderX extends Uploader { this.responseType = 'json' as XMLHttpRequestResponseType; } - async getFileURI(): Promise { + async getFileUrl(): Promise { const headers = { 'Content-Type': 'application/json; charset=UTF-8', 'X-Upload-Content-Length': `${this.size}`, @@ -40,7 +40,7 @@ export class UploaderX extends Uploader { const _ = await this.request({ method: 'PUT', body, - url: this.URI, + url: this.url, headers, progress: true }); @@ -52,7 +52,7 @@ export class UploaderX extends Uploader { 'Content-Type': 'application/octet-stream', 'Content-Range': `bytes */${this.size}` }; - const _ = await this.request({ method: 'PUT', url: this.URI, headers }); + const _ = await this.request({ method: 'PUT', url: this.url, headers }); return this.getOffsetFromResponse(); }