fix(models): Move custom method to loopback model extension
This commit is contained in:
committed by
mrugesh mohapatra
parent
19c7bb1ac9
commit
0452a9d1d5
12
common/models/Access-Token.js
Normal file
12
common/models/Access-Token.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { Observable } from 'rx';
|
||||||
|
|
||||||
|
module.exports = AccessToken => {
|
||||||
|
// wait for datasource to attach before adding methods
|
||||||
|
// prevents loopback from unnecessarily
|
||||||
|
// adding watchers on startup
|
||||||
|
AccessToken.on('dataSourceAttached', () => {
|
||||||
|
AccessToken.findOne$ = Observable.fromNodeCallback(
|
||||||
|
AccessToken.findOne.bind(AccessToken)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
@ -176,10 +176,6 @@ module.exports = function(app) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
AccessToken.findOne$ = Observable.fromNodeCallback(
|
|
||||||
AccessToken.findOne, AccessToken
|
|
||||||
);
|
|
||||||
|
|
||||||
router.get('/login', function(req, res) {
|
router.get('/login', function(req, res) {
|
||||||
res.redirect(301, '/signin');
|
res.redirect(301, '/signin');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user