use environments

This commit is contained in:
Daniel Ponte 2024-11-22 08:06:41 -05:00
parent 0e27e66a07
commit e3b48a6f65
4 changed files with 15 additions and 8 deletions

View file

@ -46,7 +46,13 @@
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
"sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
}
},
"defaultConfiguration": "production"

View file

@ -1,5 +1,6 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { environment } from './../environments/environment';
import {
HttpRequest,
HttpHandlerFn,
@ -12,17 +13,11 @@ import { AuthService } from './login/auth.service';
import { routes } from './app.routes';
import { provideHttpClient } from '@angular/common/http';
export function apiBaseInterceptor(
req: HttpRequest<unknown>,
next: HttpHandlerFn,
): Observable<HttpEvent<unknown>> {
let baseUrl: string;
if (isDevMode()) {
baseUrl = 'http://xenon:3050';
} else {
baseUrl = '';
}
let baseUrl = environment.baseUrl;
const apiReq = req.clone({ url: `${baseUrl}${req.url}` });
return next(apiReq);
}

View file

@ -0,0 +1,3 @@
export const environment = {
baseUrl: 'http://xenon:3050',
};

View file

@ -0,0 +1,3 @@
export const environment = {
baseUrl: '',
};