1
- import { Injectable } from '@angular/core' ;
2
- import { LocationStrategy , PlatformLocation } from "@angular/common" ;
1
+ import { Inject , Injectable } from '@angular/core' ;
2
+ import { LocationStrategy } from "@angular/common" ;
3
+ import { Config , FUSIO_CONFIG , Provider } from "../config/config" ;
3
4
4
5
@Injectable ( {
5
6
providedIn : 'root'
@@ -8,7 +9,7 @@ export class ProviderService {
8
9
9
10
providers : Array < Provider > = [ ] ;
10
11
11
- constructor ( private location : LocationStrategy , private config : ProviderServiceConfig ) {
12
+ constructor ( private location : LocationStrategy , @ Inject ( FUSIO_CONFIG ) private config : Config ) {
12
13
this . providers = this . getProviders ( ) ;
13
14
}
14
15
@@ -66,7 +67,7 @@ export class ProviderService {
66
67
}
67
68
68
69
public getProviders ( ) : Array < Provider > {
69
- return this . config . getProviders ( ) ;
70
+ return this . config . providers || [ ] ;
70
71
}
71
72
72
73
private getProviderByName ( name : string ) : Provider | undefined {
@@ -91,25 +92,7 @@ export class ProviderService {
91
92
92
93
}
93
94
94
- export interface Provider {
95
- name : string ,
96
- icon : string ,
97
- key : string
98
- url : string ,
99
- params : Record < string , string >
100
- }
101
-
102
95
export interface Verification {
103
96
clientId : string ,
104
97
redirectUri : string ,
105
98
}
106
-
107
- enum ProviderType {
108
- github ,
109
- google ,
110
- facebook ,
111
- }
112
-
113
- export interface ProviderServiceConfig {
114
- getProviders ( ) : Array < Provider > ;
115
- }
0 commit comments