feat(web): add auth for dev enviroment
This commit is contained in:
@@ -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<BackendResponse>(`${environment.apiUrl}/api/quote`, formData).pipe(
|
||||
return this.http.post<BackendResponse>(`${environment.apiUrl}/api/quote`, formData, { headers }).pipe(
|
||||
map(res => {
|
||||
console.log('Response for', file.name, res);
|
||||
return res;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
apiUrl: 'https://3d-fab.ch'
|
||||
apiUrl: 'https://3d-fab.ch',
|
||||
basicAuth: ''
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiUrl: 'http://localhost:8000'
|
||||
apiUrl: 'http://localhost:8000',
|
||||
basicAuth: '' // Format: 'username:password'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user