Merge pull request #16557 from BerkeleyTrue/fix/auth-inval-token

fix(AuthToken): Namespace observable methods
This commit is contained in:
mrugesh mohapatra
2018-01-23 22:25:22 +05:30
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@ -138,7 +138,7 @@ module.exports = function enableAuthentication(app) {
} }
); );
} }
return authToken.validate() return authToken.validate$()
.map(isValid => { .map(isValid => {
if (!isValid) { if (!isValid) {
throw wrapHandledError( throw wrapHandledError(
@ -153,7 +153,7 @@ module.exports = function enableAuthentication(app) {
} }
); );
} }
return authToken.destroy(); return authToken.destroy$();
}) })
.map(() => user); .map(() => user);
}); });

View File

@ -5,10 +5,10 @@ export default function(AuthToken) {
AuthToken.findOne$ = Observable.fromNodeCallback( AuthToken.findOne$ = Observable.fromNodeCallback(
AuthToken.findOne.bind(AuthToken) AuthToken.findOne.bind(AuthToken)
); );
AuthToken.prototype.validate = Observable.fromNodeCallback( AuthToken.prototype.validate$ = Observable.fromNodeCallback(
AuthToken.prototype.validate AuthToken.prototype.validate
); );
AuthToken.prototype.destroy = Observable.fromNodeCallback( AuthToken.prototype.destroy$ = Observable.fromNodeCallback(
AuthToken.prototype.destroy AuthToken.prototype.destroy
); );
}); });