This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(project): build tweaked, small dep-update
- Loading branch information
1 parent
645266b
commit 4e756a9
Showing
5 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export class AuthFilterValueConverter { | ||
/** | ||
* route toView predictator on route.config.auth === isAuthenticated | ||
* @param {RouteConfig} routes the routes array to convert | ||
* @param {Boolean} isAuthenticated authentication status | ||
* @return {Boolean} show/hide element | ||
*/ | ||
toView(routes, isAuthenticated) { | ||
return routes.filter(route => typeof route.config.auth !== 'boolean' || route.config.auth === isAuthenticated); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {inject} from 'aurelia-dependency-injection'; | ||
import {AuthService} from './aurelia-authentication'; | ||
|
||
@inject(AuthService) | ||
export class AuthenticatedFilterValueConverter { | ||
constructor(authService) { | ||
this.authService = authService; | ||
} | ||
|
||
/** | ||
* route toView predictator on route.config.auth === (parameter || authService.isAuthenticated()) | ||
* @param {RouteConfig} routes the routes array to convert | ||
* @param {[Boolean]} [isAuthenticated] optional isAuthenticated value. default: this.authService.authenticated | ||
* @return {Boolean} show/hide element | ||
*/ | ||
toView(routes, isAuthenticated = this.authService.authenticated) { | ||
return routes.filter(route => typeof route.config.auth !== 'boolean' || route.config.auth === isAuthenticated); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {inject} from 'aurelia-dependency-injection'; | ||
import {AuthService} from './aurelia-authentication'; | ||
|
||
@inject(AuthService) | ||
export class AuthenticatedValueConverter { | ||
constructor(authService) { | ||
this.authService = authService; | ||
} | ||
|
||
/** | ||
* element toView predictator on authService.isAuthenticated() | ||
* @return {Boolean} show/hide element | ||
*/ | ||
toView() { | ||
return this.authService.authenticated; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters