diff --git a/docs/server.en-US.md b/docs/server.en-US.md index ed3ebed94e..0ef444b935 100644 --- a/docs/server.en-US.md +++ b/docs/server.en-US.md @@ -11,10 +11,11 @@ Work in the form of the Restful API with the server application of any technolog In NG-ALAIN, a complete front-end UI interaction to the server-side processing flow looks like this: 1. Start Angular for the first time to execute `APP_INITIALIZER`; + - Usually some APP general data is loaded before startup, such as currently authorized user data, menu data, dictionary data, configuration data, etc. 2. UI component interaction; 3. Send the request using the encapsulated [_HttpClient](/theme/http); 4. Trigger the user authentication interceptor [@delon/auth](/auth/getting-started) and add the `token` parameter uniformly; - - If there is no `token` or an expired interrupt subsequent request, jump directly to the login page; + - If there is no `token` or an expired interrupt subsequent request, jump directly to the login page; 5. Trigger the default interceptor to process the prefix and other information; 6. Get the server back; 7. Trigger the default interceptor to handle request exceptions, business exceptions, etc. diff --git a/docs/server.zh-CN.md b/docs/server.zh-CN.md index 66ca1e5af8..779e40e9e8 100644 --- a/docs/server.zh-CN.md +++ b/docs/server.zh-CN.md @@ -12,6 +12,7 @@ NG-ALAIN 是一套基于 Angular 技术栈的单页面应用,我们提供的 在 NG-ALAIN 中,一个完整的前端 UI 交互到服务端处理流程是这样的: 1. 首次启动 Angular 执行 `APP_INITIALIZER`; + - 通常会在启动前先加载一些APP通用数据,例如:当前已授权用户数据、菜单数据、字典数据、配置项等 2. UI 组件交互操作; 3. 使用封装的 [_HttpClient](/theme/http) 发送请求; 4. 触发用户认证拦截器 [@delon/auth](/auth/getting-started),统一加入 `token` 参数; diff --git a/schematics/application/files/src/app/core/startup/startup.service.ts b/schematics/application/files/src/app/core/startup/startup.service.ts index 7902565075..e2dfe20798 100644 --- a/schematics/application/files/src/app/core/startup/startup.service.ts +++ b/schematics/application/files/src/app/core/startup/startup.service.ts @@ -61,6 +61,8 @@ export class StartupService { } <% } else { %> private viaHttp(): Observable { + // If http request allows anonymous access, you need to add `ALLOW_ANONYMOUS`: + // this.httpClient.get('assets/tmp/app-data.json', { context: new HttpContext().set(ALLOW_ANONYMOUS, true) }) return this.httpClient.get('assets/tmp/app-data.json').pipe( catchError((res: NzSafeAny) => { console.warn(`StartupService.load: Network request failed`, res); @@ -103,7 +105,7 @@ export class StartupService { // } // mock const app: any = { - name: `ng-alain`, + name: `NG-ALAIN`, description: `Ng-zorro admin panel front-end framework` }; const user: any = {