Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const handlers = {
},
params: {
hitsPerPage: 1,
filters (requestBody) {
return `brand:${requestBody.request.intent.slots.brand.value}`;
filters (event, context) {
return `brand:${event.request.intent.slots.brand.value}`;
}
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/utils/build_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function buildFromObject(obj, index, stateString) {

object[key] = function() {
const args = {event: this.event};
const params = buildParams(paramsObj, this.event);
const params = buildParams(paramsObj, this.event, this);
let query = '';
if (args.event.request.intent.slots && args.event.request.intent.slots.query) {
query = args.event.request.intent.slots.query.value;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/build_params.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {isObject, isFunction} from './is_of_type.js';

export default function buildParams (params, event) {
export default function buildParams (params, event, context) {
if (params === undefined || params === null) {
return {};
}
Expand All @@ -14,7 +14,7 @@ export default function buildParams (params, event) {
for (const prop in builtParams) {
if (builtParams.hasOwnProperty(prop)) {
if (isFunction(builtParams[prop])) {
builtParams[prop] = builtParams[prop](event);
builtParams[prop] = builtParams[prop](event, context);
}
}
}
Expand Down