Factory function for creating a real service or a mock service
export function locationsServiceFactory() { | |
return (http: HttpClient, configService: AppConfigService, logging: LoggingService): LocationsService => { | |
if (configService.useFakeData) { | |
logging.logInfo('use mock service'); | |
return new LocationsServiceMock(); | |
} else { | |
logging.logInfo('use real service'); | |
return new LocationsServiceImpl(http, configService); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment