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('filament', this.mapMaterial(request.material));
|
||||||
formData.append('quality', this.mapQuality(request.quality));
|
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`);
|
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 => {
|
map(res => {
|
||||||
console.log('Response for', file.name, res);
|
console.log('Response for', file.name, res);
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
apiUrl: 'https://3d-fab.ch'
|
apiUrl: 'https://3d-fab.ch',
|
||||||
|
basicAuth: ''
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
apiUrl: 'http://localhost:8000'
|
apiUrl: 'http://localhost:8000',
|
||||||
|
basicAuth: '' // Format: 'username:password'
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user