EchoTex_Payroll/HRM.UI/ClientApp/src/main.ts
2024-10-14 10:01:49 +06:00

61 lines
2.0 KiB
TypeScript

import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app/app.module';
import {environment} from './environments/environment';
import {
MSAL_GUARD_CONFIG,
MSAL_INSTANCE,
MSAL_INTERCEPTOR_CONFIG,
MsalGuardConfiguration,
MsalInterceptorConfiguration
} from '@azure/msal-angular';
import {LogLevel, PublicClientApplication} from '@azure/msal-browser';
if (environment.production) {
enableProdMode();
}
function loggerCallback(logLevel: LogLevel, message: string) {
console.log('MSAL Angular: ', message);
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
/*fetch('/assets/configuration.json')
.then(response => response.json())
.then(json => {
platformBrowserDynamic([
{
provide: MSAL_INSTANCE, useValue: new PublicClientApplication({
auth: json.msal.auth,
cache: json.msal.cache,
system: {
loggerOptions: {
loggerCallback,
logLevel: LogLevel.Info,
piiLoggingEnabled: false
}
}
})
},
{
provide: MSAL_GUARD_CONFIG, useValue: {
interactionType: json.guard.interactionType,
authRequest: json.guard.authRequest,
loginFailedRoute: json.guard.loginFailedRoute
} as MsalGuardConfiguration
},
{
provide: MSAL_INTERCEPTOR_CONFIG, useValue: {
interactionType: json.interceptor.interactionType,
protectedResourceMap: new Map(json.interceptor.protectedResourceMap)
} as MsalInterceptorConfiguration
},
])
.bootstrapModule(AppModule)
.catch(err => console.error(err));
});*/