mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
AAE-37293 switch to provider api (#4735)
This commit is contained in:
+12
-45
@@ -22,18 +22,9 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { importProvidersFrom, ApplicationConfig, Provider, EnvironmentProviders } from '@angular/core';
|
||||
import { importProvidersFrom, ApplicationConfig } from '@angular/core';
|
||||
import { provideNoopAnimations, provideAnimations } from '@angular/platform-browser/animations';
|
||||
import {
|
||||
AuthGuard,
|
||||
AuthModule,
|
||||
provideTranslations,
|
||||
provideAppConfig,
|
||||
FORM_FIELD_MODEL_RENDER_MIDDLEWARE,
|
||||
DecimalRenderMiddlewareService,
|
||||
AuthenticationService,
|
||||
TranslateLoaderService
|
||||
} from '@alfresco/adf-core';
|
||||
import { AuthGuard, provideAppConfig, provideCoreAuth, provideI18N } from '@alfresco/adf-core';
|
||||
import { AppService, provideContentAppExtensions } from '@alfresco/aca-shared';
|
||||
import { provideApplicationExtensions } from './extensions.module';
|
||||
import { environment } from '../environments/environment';
|
||||
@@ -59,10 +50,7 @@ import { CONTENT_LAYOUT_ROUTES, ContentServiceExtensionModule, ContentUrlService
|
||||
import { ContentVersionService } from '@alfresco/adf-content-services';
|
||||
import { SHELL_APP_SERVICE, SHELL_AUTH_TOKEN, provideShellRoutes } from '@alfresco/adf-core/shell';
|
||||
import { APP_ROUTES } from './app.routes';
|
||||
import { HTTP_INTERCEPTORS, HttpClient, provideHttpClient, withInterceptorsFromDi, withXsrfConfiguration } from '@angular/common/http';
|
||||
import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
|
||||
import { Authentication, AuthenticationInterceptor } from '@alfresco/adf-core/auth';
|
||||
import { provideTranslateService, TranslateLoader } from '@ngx-translate/core';
|
||||
|
||||
registerLocaleData(localeFr);
|
||||
registerLocaleData(localeDe);
|
||||
@@ -81,40 +69,14 @@ registerLocaleData(localeFi);
|
||||
registerLocaleData(localeDa);
|
||||
registerLocaleData(localeSv);
|
||||
|
||||
/* The replacement for the CoreModule.forRoot() */
|
||||
function provideAdfCore(): (Provider | EnvironmentProviders)[] {
|
||||
return [
|
||||
provideAppConfig(),
|
||||
provideHttpClient(withInterceptorsFromDi(), withXsrfConfiguration({ cookieName: 'CSRF-TOKEN', headerName: 'X-CSRF-TOKEN' })),
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: AuthenticationInterceptor, multi: true },
|
||||
{ provide: Authentication, useClass: AuthenticationService },
|
||||
{
|
||||
provide: MAT_SNACK_BAR_DEFAULT_OPTIONS,
|
||||
useValue: {
|
||||
duration: 10000
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE,
|
||||
useClass: DecimalRenderMiddlewareService,
|
||||
multi: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export const AppConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
importProvidersFrom(AuthModule.forRoot({ useHash: true })),
|
||||
provideCoreAuth({ useHash: true }),
|
||||
provideAppConfig(),
|
||||
importProvidersFrom(ContentServiceExtensionModule),
|
||||
provideTranslateService({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderService,
|
||||
deps: [HttpClient]
|
||||
},
|
||||
defaultLanguage: 'en'
|
||||
provideI18N({
|
||||
assets: [['app', 'assets']]
|
||||
}),
|
||||
provideAdfCore(),
|
||||
provideContentAppExtensions(),
|
||||
provideApplicationExtensions(),
|
||||
provideRouter(APP_ROUTES, withHashLocation()),
|
||||
@@ -129,6 +91,11 @@ export const AppConfig: ApplicationConfig = {
|
||||
provide: SHELL_AUTH_TOKEN,
|
||||
useValue: AuthGuard
|
||||
},
|
||||
provideTranslations('app', 'assets')
|
||||
{
|
||||
provide: MAT_SNACK_BAR_DEFAULT_OPTIONS,
|
||||
useValue: {
|
||||
duration: 10000
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user