change host and demo

This commit is contained in:
Mario Romano
2016-06-02 15:48:47 +01:00
parent a3171ee9df
commit ac1cf8a781
3 changed files with 44 additions and 17 deletions

View File

@@ -33,7 +33,6 @@ declare let AlfrescoApi: any;
*/
@Injectable()
export class UploadService {
private _host: string = '';
private _baseUrlPath: string = '/alfresco/api/-default-/public/alfresco/versions/1';
private _url: string = '/alfresco/service/api/upload';
@@ -51,7 +50,6 @@ export class UploadService {
constructor(private settings: AlfrescoSettingsService) {
console.log('UploadService constructor');
this.filesUpload$ = new Observable(observer => this._filesUploadObserver = observer).share();
this._host = settings.host;
this._alfrescoClient = this.getAlfrescoClient();
}
@@ -72,7 +70,7 @@ export class UploadService {
* @returns {string}
*/
public getHost(): string {
return this._host;
return this.settings.host;
}
/**
@@ -220,7 +218,7 @@ export class UploadService {
let xmlHttpRequest = this.createXMLHttpRequestInstance(uploadingFileModel, elementEmit);
uploadingFileModel._xmlHttpRequest = xmlHttpRequest;
xmlHttpRequest.open(this._method, this._host + this._url, true);
xmlHttpRequest.open(this._method, this.getHost() + this._url, true);
let authToken = btoa(basicAuth.username + ':' + basicAuth.password);
if (authToken) {
xmlHttpRequest.setRequestHeader('Authorization', `${basicAuth.type} ${authToken}`);