2 Commits

Author SHA1 Message Date
a5ff515fd7 feat(web): add auth for dev enviroment
All checks were successful
Build, Test and Deploy / test-backend (push) Successful in 12s
Build, Test and Deploy / build-and-push (push) Successful in 21s
Build, Test and Deploy / deploy (push) Successful in 4s
2026-02-02 18:48:06 +01:00
6952090865 feat(web): add auth for dev enviroment 2026-02-02 18:45:22 +01:00
3 changed files with 12 additions and 3 deletions

View File

@@ -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;

View File

@@ -1,4 +1,5 @@
export const environment = {
production: true,
apiUrl: 'https://3d-fab.ch'
apiUrl: 'https://3d-fab.ch',
basicAuth: ''
};

View File

@@ -1,4 +1,5 @@
export const environment = {
production: false,
apiUrl: 'http://localhost:8000'
apiUrl: 'https://dev.3d-fab.ch',
basicAuth: 'fab:0presura' // Format: 'username:password'
};