Undo incorrect changes I made -- per Ritchie

This commit is contained in:
Rand McKinney 2014-06-03 15:14:46 -07:00
parent 87c9672362
commit 78d1e3b966
1 changed files with 6 additions and 6 deletions

View File

@ -126,16 +126,16 @@ Run a function before or after a remote method is called by a client.
```js
// *.save === prototype.save
User.beforeRemote('*.save', function(ctx, next) {
if(ctx.user) {
User.beforeRemote('*.save', function(ctx, user, next) {
if(ctx.req.accessToken) {
next();
} else {
next(new Error('must be logged in to update'))
}
});
User.afterRemote('*.save', function(ctx, next) {
console.log('user has been saved', ctx.user);
User.afterRemote('*.save', function(ctx, user, next) {
console.log('user has been saved', user);
next();
});
```
@ -144,7 +144,7 @@ Remote hooks also support wildcards. Run a function before any remote method is
```js
// ** will match both prototype.* and *.*
User.beforeRemote('**', function(ctx, next) {
User.beforeRemote('**', function(ctx, user, next) {
console.log(ctx.methodString, 'was invoked remotely'); // users.prototype.save was invoked remotely
next();
});
@ -160,7 +160,7 @@ User.beforeRemote('*', ...);
User.beforeRemote('prototype.*', ...);
// prevent password hashes from being sent to clients
User.afterRemote('**', function (ctx, next) {
User.afterRemote('**', function (ctx, user, next) {
if(ctx.result) {
if(Array.isArray(ctx.result)) {
ctx.result.forEach(function (result) {