This commit is contained in:
Bastian Wagner
2026-07-15 14:31:56 +02:00
parent 3e5348b7ec
commit 0fd85573d2
11 changed files with 128 additions and 14 deletions

3
apps/web/src/config.js Normal file
View File

@@ -0,0 +1,3 @@
window.__LDAP_PORTAL_CONFIG__ = {
apiBaseUrl: 'http://localhost:3000'
};

View File

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

View File

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