diff --git a/frontend/src/app/features/calculator/services/quote-estimator.service.ts b/frontend/src/app/features/calculator/services/quote-estimator.service.ts index 2965a8f..faa8a96 100644 --- a/frontend/src/app/features/calculator/services/quote-estimator.service.ts +++ b/frontend/src/app/features/calculator/services/quote-estimator.service.ts @@ -47,8 +47,15 @@ export class QuoteEstimatorService { formData.append('filament', this.mapMaterial(request.material)); formData.append('quality', this.mapQuality(request.quality)); + const headers: any = {}; + // @ts-ignore + if (environment.basicAuth) { + // @ts-ignore + headers['Authorization'] = 'Basic ' + btoa(environment.basicAuth); + } + console.log(`Sending file: ${file.name} to ${environment.apiUrl}/api/quote`); - return this.http.post(`${environment.apiUrl}/api/quote`, formData).pipe( + return this.http.post(`${environment.apiUrl}/api/quote`, formData, { headers }).pipe( map(res => { console.log('Response for', file.name, res); return res; diff --git a/frontend/src/environments/environment.prod.ts b/frontend/src/environments/environment.prod.ts index ec59c25..008dae6 100644 --- a/frontend/src/environments/environment.prod.ts +++ b/frontend/src/environments/environment.prod.ts @@ -1,4 +1,5 @@ export const environment = { production: true, - apiUrl: 'https://3d-fab.ch' + apiUrl: 'https://3d-fab.ch', + basicAuth: '' }; diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts index 837417a..f838d5c 100644 --- a/frontend/src/environments/environment.ts +++ b/frontend/src/environments/environment.ts @@ -1,4 +1,5 @@ export const environment = { production: false, - apiUrl: 'http://localhost:8000' + apiUrl: 'http://localhost:8000', + basicAuth: '' // Format: 'username:password' };