mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
extend environment and use injected app config
This commit is contained in:
@@ -11,13 +11,13 @@ import { hasValue } from './app/shared/empty.util';
|
||||
import { BrowserAppModule } from './modules/app/browser-app.module';
|
||||
|
||||
import { environment } from './environments/environment';
|
||||
import { AppConfig } from './config/app-config.interface';
|
||||
import { extendEnvironmentWithAppConfig } from './config/config.util';
|
||||
|
||||
// import { AppConfig, APP_CONFIG } from './config/app-config.interface';
|
||||
// import { extendEnvironmentWithAppConfig } from './config/config.util';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
const bootstrap = () => platformBrowserDynamic()
|
||||
.bootstrapModule(BrowserAppModule, {
|
||||
preserveWhitespaces: true
|
||||
});
|
||||
|
||||
const main = () => {
|
||||
// Load fonts async
|
||||
@@ -28,10 +28,22 @@ const main = () => {
|
||||
}
|
||||
});
|
||||
|
||||
return platformBrowserDynamic()
|
||||
.bootstrapModule(BrowserAppModule, {
|
||||
preserveWhitespaces: true
|
||||
});
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
|
||||
return bootstrap();
|
||||
} else {
|
||||
|
||||
return fetch('assets/appConfig.json')
|
||||
.then((response) => response.json())
|
||||
.then((appConfig: AppConfig) => {
|
||||
|
||||
// extend environment with app config for browser when not prerendered
|
||||
extendEnvironmentWithAppConfig(environment, appConfig);
|
||||
|
||||
return bootstrap();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// support async tag or hmr
|
||||
@@ -40,11 +52,3 @@ if (hasValue(environment.universal) && environment.universal.preboot === false)
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', main);
|
||||
}
|
||||
|
||||
|
||||
// fetch('assets/appConfig.json')
|
||||
// .then((response) => response.json())
|
||||
// .then((appConfig: AppConfig) => {
|
||||
// // extend environment with app config for client side use
|
||||
// extendEnvironmentWithAppConfig(environment, appConfig);
|
||||
// });
|
||||
|
Reference in New Issue
Block a user