-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix
provideMockConfig
(#1703)
- Loading branch information
Showing
10 changed files
with
36 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
import { ɵHTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http'; | ||
import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core'; | ||
|
||
import { MockOptions } from './interface'; | ||
import { mockInterceptor } from './mock.interceptor'; | ||
import { MockService } from './mock.service'; | ||
|
||
export const DELON_MOCK_CONFIG = new InjectionToken<MockOptions>('alain-mock-config'); | ||
|
||
export function provideDelonMockConfig(config?: MockOptions): EnvironmentProviders { | ||
return makeEnvironmentProviders([{ provide: DELON_MOCK_CONFIG, useValue: config }]); | ||
export function provideMockConfig(config?: MockOptions): EnvironmentProviders { | ||
return makeEnvironmentProviders([ | ||
{ provide: DELON_MOCK_CONFIG, useValue: config }, | ||
{ | ||
provide: ɵHTTP_ROOT_INTERCEPTOR_FNS, | ||
useValue: mockInterceptor, | ||
multi: true, | ||
deps: [MockService] | ||
} | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters