@@ -30,13 +30,18 @@ The repository can be found [here](https://github.com/neroniaky/angular2-token-e
3030 - [ ` .updatePassword() ` ] ( #updatepassword )
3131 - [ ` .resetPassword() ` ] ( #resetpassword )
3232- [ HTTP Service Wrapper] ( #http-service-wrapper )
33- - [ ` .sendHttpRequest() ` ] ( #sendhttprequest )
3433- [ Multiple User Types] ( #multiple-user-types )
3534- [ Route Guards] ( #route-guards )
36- - [ Testing] ( #testing )
35+ - [ Advanced Usage] ( #advanced-usage )
36+ - [ ` .sendHttpRequest() ` ] ( #sendhttprequest )
37+ - [ ` .userSignedIn() ` ] ( #usersignedin )
38+ - [ ` .currentUserType ` ] ( #currentusertype )
39+ - [ ` .currentUserData ` ] ( #currentuserdata )
40+ - [ ` .currentAuthData ` ] ( #currentauthdata )
3741- [ Development] ( #development )
38- - [ Credits] ( #credits )
39- - [ License] ( #license )
42+ - [ Testing] ( #testing )
43+ - [ Credits] ( #credits )
44+ - [ License] ( #license )
4045
4146## Installation
42471 . Install Angular2-Token via NPM with
@@ -263,21 +268,6 @@ this._tokenService.get('my-resource/1').map(res => res.json()).subscribe(
263268);
264269` ` `
265270
266- # ## .sendHttpRequest()
267- More customized requests can be send with the ` .sendHttpRequest()` -function. It accepts the RequestOptions-Class.
268- More information can be found in the Angular2 API Reference [here](https://angular.io/docs/ts/latest/api/http/index/RequestOptions-class.html).
269-
270- ` sendHttpRequest(options: RequestOptions): Observable< Response> `
271-
272- # ### Example:
273- ` ` ` javascript
274- this.sendHttpRequest(new RequestOptions({
275- method: RequestMethod.Post,
276- url: ' my-resource/1' ,
277- data: mydata
278- }));
279- ` ` `
280-
281271# # Multiple User Types
282272An array of ` UserType` can be passed in ` Angular2TokenOptions` during ` init()` .
283273The user type is selected during sign in and persists until sign out.
@@ -320,11 +310,45 @@ const routerConfig: Routes = [
320310];
321311` ` `
322312
323- # # Testing
324- ` ` ` bash
325- npm test
313+ # # Advanced Usage
314+ More advanced methods can be used if a higher degree of customization is required.
315+
316+ # ## .sendHttpRequest()
317+ More customized requests can be send with the `.sendHttpRequest ()` -function. It accepts the RequestOptions-Class.
318+ More information can be found in the Angular2 API Reference [here](https://angular.io/docs/ts/latest/api/http/index/RequestOptions-class.html).
319+
320+ ` sendHttpRequest(options: RequestOptions): Observable< Response> `
321+
322+ # ### Example:
323+ ` ` ` javascript
324+ this.sendHttpRequest(new RequestOptions({
325+ method: RequestMethod.Post,
326+ url: ' my-resource/1' ,
327+ data: mydata
328+ }));
326329` ` `
327330
331+ # ## .userSignedIn()
332+ Returns ` true` if a user is signed in. It does not distinguish between user types.
333+
334+ `userSignedIn (): boolean`
335+
336+ # ## .currentUserType
337+ Returns current user type as string like specified in the options.
338+
339+ ` get currentUserType (): string`
340+
341+ # ## .currentUserData
342+ Returns current user data as returned by devise token auth.
343+ This variable is ` null` after page reload until the `.validateToken ()` call is answerd by the backend.
344+
345+ ` get currentUserData (): UserData`
346+
347+ # ## .currentAuthData
348+ Returns current authentication data which are used to set auth headers.
349+
350+ ` get currentAuthData (): AuthData`
351+
328352# # Development
329353If the package is installed from Github specified in the package.json, you need to build the package locally.
330354
@@ -334,8 +358,13 @@ npm install
334358npm run build
335359` ` `
336360
337- # # Credits
361+ # ## Testing
362+ ` ` ` bash
363+ npm test
364+ ` ` `
365+
366+ # ## Credits
338367Test config files based on [Angular2 Webpack Starter](https://github.com/AngularClass/angular2-webpack-starter) by AngularClass
339368
340- # # License
369+ # ## License
341370The MIT License (see the [LICENSE](https://github.com/neroniaky/angular2-token/blob/master/LICENSE) file for the full text)
0 commit comments