2020-03-27 17:43:47 +09:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
|
|
|
|
import axios from 'axios';
|
|
|
|
import { AxiosInstance } from 'axios';
|
|
|
|
|
|
|
|
import { AXIOS_INSTANCE } from '@ucap/ng-core';
|
2020-03-30 17:14:23 +09:00
|
|
|
import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native';
|
2020-03-27 17:43:47 +09:00
|
|
|
|
2020-03-30 17:14:23 +09:00
|
|
|
import { environment } from '@environments';
|
|
|
|
|
|
|
|
import { AppAuthenticationGuard } from './guards/app-authentication.guard';
|
|
|
|
|
|
|
|
import { AppAuthenticationService } from './services/app-authentication.service';
|
|
|
|
import { AppNativeService } from './services/app-native.service';
|
|
|
|
|
|
|
|
const GUARDS = [AppAuthenticationGuard];
|
|
|
|
const SERVICES = [AppAuthenticationService, AppNativeService];
|
|
|
|
|
|
|
|
const axiosFactory = () => {
|
|
|
|
const i = axios.create();
|
|
|
|
|
|
|
|
console.log('axios', i);
|
|
|
|
|
|
|
|
return i;
|
|
|
|
};
|
2020-03-27 17:43:47 +09:00
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [],
|
|
|
|
exports: [],
|
|
|
|
providers: [
|
|
|
|
{
|
|
|
|
provide: AXIOS_INSTANCE,
|
|
|
|
useFactory: axiosFactory,
|
|
|
|
deps: [],
|
|
|
|
multi: false
|
2020-03-30 17:14:23 +09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
provide: UCAP_NATIVE_SERVICE,
|
|
|
|
useClass: environment.productConfig.nativeServiceClass,
|
|
|
|
deps: [AXIOS_INSTANCE],
|
|
|
|
multi: false
|
|
|
|
},
|
|
|
|
...GUARDS,
|
|
|
|
...SERVICES
|
2020-03-27 17:43:47 +09:00
|
|
|
]
|
|
|
|
})
|
|
|
|
export class AppProviderModule {}
|