use environments
This commit is contained in:
parent
0e27e66a07
commit
e3b48a6f65
4 changed files with 15 additions and 8 deletions
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
3
client/admin/src/environments/environment.development.ts
Normal file
3
client/admin/src/environments/environment.development.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export const environment = {
|
||||
baseUrl: 'http://xenon:3050',
|
||||
};
|
3
client/admin/src/environments/environment.ts
Normal file
3
client/admin/src/environments/environment.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export const environment = {
|
||||
baseUrl: '',
|
||||
};
|
Loading…
Reference in a new issue