Skip to content

Refactor/client types #2025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 5, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions templates/app/client/components/auth(auth)/auth.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function AuthService($location, $http, $cookies, $q, appConfig, Util, Use
/**
* Gets all available info on a user
*
* @param {Function} [callback] - funciton(user)
* @param {Function} [callback] - optional, function(user)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"optional, " is redundant here

* @return {Promise}
*/
getCurrentUser(callback) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't the fix be to say callback?: Function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a more informative type definition for it. Was not sure it was valid Flow syntax as well but it does appear to be. Examples or documentation of each for reference: Flow documentation TS example.

Should probably change all the other async functions then in auth.service as I kinda only copied documentation from them while all of them use the same Util.safeCb to make it optional.

Will just do it now.

Expand Down Expand Up @@ -134,7 +134,7 @@ export function AuthService($location, $http, $cookies, $q, appConfig, Util, Use
* @return {Bool|Promise}
*/
isLoggedIn(callback) {
return Auth.getCurrentUser()
return Auth.getCurrentUser(undefined)
.then(user => {
var is = user.hasOwnProperty('role');
safeCb(callback)(is);
Expand All @@ -159,7 +159,7 @@ export function AuthService($location, $http, $cookies, $q, appConfig, Util, Use
* @return {Bool|Promise}
*/
hasRole(role, callback) {
return Auth.getCurrentUser()
return Auth.getCurrentUser(undefined)
.then(user => {
var has = user.hasOwnProperty('role')
? hasRole(user.role, role)
Expand Down