File tree Expand file tree Collapse file tree 3 files changed +23
-10
lines changed Expand file tree Collapse file tree 3 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ this.sendHttpRequest(new RequestOptions({
268
268
# # Multiple User Types
269
269
An array of ` UserType` can be passed in ` Angular2TokenOptions` during ` init()` .
270
270
The user type is selected during sign in and persists until sign out.
271
- ` .currentUser ` returns the currently logged in user.
271
+ ` .currentUserType ` returns the currently logged in user.
272
272
273
273
# ### Example:
274
274
` ` ` javascript
@@ -285,7 +285,7 @@ this._tokenService.signIn(
285
285
' ADMIN'
286
286
)
287
287
288
- this._tokenService.currentUser ; // ADMIN
288
+ this._tokenService.currentUserType ; // ADMIN
289
289
` ` `
290
290
291
291
# # Route Guards
Original file line number Diff line number Diff line change 1
- export interface UserType {
2
- name : string ;
3
- path : string ;
4
- }
5
-
6
1
export interface AuthData {
7
2
accessToken : string ;
8
3
client : string ;
@@ -11,8 +6,25 @@ export interface AuthData {
11
6
uid : string ;
12
7
}
13
8
9
+ export interface UserData {
10
+ id : number ;
11
+ provider : string ;
12
+ uid : string ;
13
+ name : string ;
14
+ nickname : string ;
15
+ image : any ;
16
+ email : string ;
17
+ }
18
+
19
+ // Configuration Options
20
+
21
+ export interface UserType {
22
+ name : string ;
23
+ path : string ;
24
+ }
25
+
14
26
export interface OAuthPaths {
15
- github ?: string ;
27
+ github ?: string ;
16
28
}
17
29
18
30
export interface Angular2TokenOptions {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import 'rxjs/add/operator/share';
14
14
15
15
import {
16
16
UserType ,
17
+ UserData ,
17
18
AuthData ,
18
19
Angular2TokenOptions
19
20
} from './angular2-token.model' ;
@@ -28,14 +29,14 @@ export class Angular2TokenService implements CanActivate {
28
29
return null ;
29
30
}
30
31
31
- get currentUserData ( ) : string {
32
+ get currentUserData ( ) : UserData {
32
33
return this . _currentUserData ;
33
34
}
34
35
35
36
private _options : Angular2TokenOptions ;
36
37
private _currentUserType : UserType ;
37
38
private _currentAuthData : AuthData ;
38
- private _currentUserData : any ;
39
+ private _currentUserData : UserData ;
39
40
40
41
constructor (
41
42
private _http : Http ,
You can’t perform that action at this time.
0 commit comments