mirror of https://github.com/abpframework/abp
				
				
				
			Merge pull request #15626 from abpframework/auto-merge/rel-7-0/1703
	
		
	
				
					
				
			Merge branch dev with rel-7.0pull/15627/head
						commit
						3e27cea16e
					
				| @ -0,0 +1,30 @@ | ||||
| import { HttpClient, HttpContext, HttpRequest } from '@angular/common/http'; | ||||
| import { Injectable } from '@angular/core'; | ||||
| import { Observable } from 'rxjs'; | ||||
| import { IS_EXTERNAL_REQUEST } from '../tokens/http-context.token'; | ||||
| 
 | ||||
| // source : https://github.com/armanozak/demo-angular-server-specific-interceptors
 | ||||
| @Injectable({ | ||||
|   providedIn: 'root', | ||||
| }) | ||||
| export class ExternalHttpClient extends HttpClient { | ||||
|   override request( | ||||
|     first: string | HttpRequest<any>, | ||||
|     url?: string, | ||||
|     options: RequestOptions = {}, | ||||
|   ): Observable<any> { | ||||
|     if (typeof first === 'string') { | ||||
|       this.#setPlaceholderContext(options); | ||||
|       return super.request(first, url, options); | ||||
|     } | ||||
| 
 | ||||
|     this.#setPlaceholderContext(first); | ||||
|     return super.request(first); | ||||
|   } | ||||
|   #setPlaceholderContext(optionsOrRequest: { context?: HttpContext }) { | ||||
|     optionsOrRequest.context ??= new HttpContext(); | ||||
|     optionsOrRequest.context.set(IS_EXTERNAL_REQUEST, true); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| type RequestOptions = Parameters<HttpClient['request']>[2]; | ||||
| @ -0,0 +1 @@ | ||||
| export * from './http.client'; | ||||
| @ -1,8 +1,7 @@ | ||||
|  import { Provider } from "@angular/core"; | ||||
|  import { INCUDE_LOCALIZATION_RESOURCES_TOKEN } from "../tokens/include-localization-resources.token"; | ||||
| import { Provider } from '@angular/core'; | ||||
| import { INCUDE_LOCALIZATION_RESOURCES_TOKEN } from '../tokens/include-localization-resources.token'; | ||||
| 
 | ||||
| export const IncludeLocalizationResourcesProvider: Provider = { | ||||
|     provide: INCUDE_LOCALIZATION_RESOURCES_TOKEN, | ||||
|     useValue: false, | ||||
|    }; | ||||
|    | ||||
|   provide: INCUDE_LOCALIZATION_RESOURCES_TOKEN, | ||||
|   useValue: false, | ||||
| }; | ||||
|  | ||||
| @ -1,3 +1,3 @@ | ||||
| export * from './cookie-language.provider'; | ||||
| export * from './locale.provider'; | ||||
| export * from './include-localization-resources.provider'; | ||||
| export * from './include-localization-resources.provider'; | ||||
|  | ||||
| @ -0,0 +1,3 @@ | ||||
| import { HttpContextToken } from '@angular/common/http'; | ||||
| 
 | ||||
| export const IS_EXTERNAL_REQUEST = new HttpContextToken<boolean>(() => false); | ||||
| @ -1,3 +1,5 @@ | ||||
| import { InjectionToken } from "@angular/core"; | ||||
| import { InjectionToken } from '@angular/core'; | ||||
| 
 | ||||
| export const INCUDE_LOCALIZATION_RESOURCES_TOKEN = new InjectionToken<boolean>('INCUDE_LOCALIZATION_RESOURCES_TOKEN'); | ||||
| export const INCUDE_LOCALIZATION_RESOURCES_TOKEN = new InjectionToken<boolean>( | ||||
|   'INCUDE_LOCALIZATION_RESOURCES_TOKEN', | ||||
| ); | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue
	
	 Mahmut Gundogdu
						Mahmut Gundogdu