fix(AuthToken): Namespace observable methods

This prevents methods that use the regular methods internally from
clashing
This commit is contained in:
Berkeley Martinez
2018-01-22 11:59:24 -08:00
parent 70a4ebe4f7
commit 1dcdf4e17c
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
); );
}); });