Handle express-validator error on the client side and fix #96 (#98)
[oweals/peertube.git] / client / src / app / environment.ts
1 /* tslint:disable */
2
3 /**
4  * Angular 2
5  */
6 import {
7   enableDebugTools,
8   disableDebugTools
9 } from '@angular/platform-browser';
10 import {
11   ApplicationRef,
12   enableProdMode
13 } from '@angular/core';
14 /**
15  * Environment Providers
16  */
17 let PROVIDERS: any[] = [
18   /**
19    * Common env directives
20    */
21 ];
22
23 /**
24  * Angular debug tools in the dev console
25  * https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
26  */
27 let _decorateModuleRef = <T>(value: T): T => { return value; };
28
29 if ('production' === ENV) {
30   enableProdMode();
31
32   /**
33    * Production
34    */
35   _decorateModuleRef = (modRef: any) => {
36     disableDebugTools();
37
38     return modRef;
39   };
40
41   PROVIDERS = [
42     ...PROVIDERS,
43     /**
44      * Custom providers in production.
45      */
46   ];
47
48 } else {
49
50   _decorateModuleRef = (modRef: any) => {
51     const appRef = modRef.injector.get(ApplicationRef);
52     const cmpRef = appRef.components[0];
53
54     let _ng = (<any> window).ng;
55     enableDebugTools(cmpRef);
56     (<any> window).ng.probe = _ng.probe;
57     (<any> window).ng.coreTokens = _ng.coreTokens;
58     return modRef;
59   };
60
61   /**
62    * Development
63    */
64   PROVIDERS = [
65     ...PROVIDERS,
66     /**
67      * Custom providers in development.
68      */
69   ];
70
71 }
72
73 export const decorateModuleRef = _decorateModuleRef;
74
75 export const ENV_PROVIDERS = [
76   ...PROVIDERS
77 ];