Created
July 24, 2018 10:32
-
-
Save dmastag/5d4fd8436e4559fb8ae9da7a965ca763 to your computer and use it in GitHub Desktop.
Cara di Loopback untuk memaksa penambahan Limit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member.beforeRemote( | |
"prototype.__get__tickets", | |
async (ctx, instance, next) => { | |
if (!ctx.args.filter || !ctx.args.filter.limit) { | |
if (!ctx.args.filter) ctx.args.filter = {}; | |
ctx.args.filter.limit = 10; | |
} else { | |
ctx.args.filter.limit = Math.min(ctx.args.filter.limit, 10); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment