docker
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
"browser": "src/main.ts",
|
||||
"polyfills": ["zone.js"],
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"assets": ["src/favicon.ico"],
|
||||
"assets": ["src/favicon.ico", "src/config.js"],
|
||||
"styles": ["src/styles.css"]
|
||||
},
|
||||
"configurations": {
|
||||
|
||||
3
apps/web/src/config.js
Normal file
3
apps/web/src/config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
window.__LDAP_PORTAL_CONFIG__ = {
|
||||
apiBaseUrl: 'http://localhost:3000'
|
||||
};
|
||||
@@ -5,6 +5,7 @@
|
||||
<title>LDAP Portal</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script src="/config.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
|
||||
@@ -19,6 +19,14 @@ import { VerifyEmailComponent } from './app/pages/verify-email.component';
|
||||
import { API_BASE_URL } from './app/shared/api-base-url';
|
||||
import { AuthService } from './app/shared/auth.service';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__LDAP_PORTAL_CONFIG__?: {
|
||||
apiBaseUrl?: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const authInterceptor: HttpInterceptorFn = (request, next) => {
|
||||
const token = localStorage.getItem('accessToken');
|
||||
if (!token) {
|
||||
@@ -58,6 +66,6 @@ bootstrapApplication(AppComponent, {
|
||||
provideRouter(routes),
|
||||
provideHttpClient(withInterceptors([authInterceptor])),
|
||||
AuthService,
|
||||
{ provide: API_BASE_URL, useValue: 'http://localhost:3000' },
|
||||
{ provide: API_BASE_URL, useValue: window.__LDAP_PORTAL_CONFIG__?.apiBaseUrl ?? 'http://localhost:3000' },
|
||||
],
|
||||
}).catch((error) => console.error(error));
|
||||
|
||||
Reference in New Issue
Block a user