Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
subscribe(categoryWillEnter$, ({ dispatch, action }) => {
const { filters, offset = 0 } = action.route.state;
const categoryId = hex2bin(action.route.params.categoryId);
dispatch(fetchCategory(categoryId));
dispatch(fetchCategoryProducts({
categoryId,
filters,
offset,
}));
});
subscribe(categoryWillEnter$, ({ dispatch, action }) => {
const { filters, offset = 0 } = action.route.state;
const categoryId = hex2bin(action.route.params.categoryId);
dispatch(fetchCategory(categoryId));
dispatch(fetchCategoryProducts({
categoryId,
filters,
offset,
}));
});
subscribe(categoryFiltersDidUpdate$, ({ action, dispatch, getState }) => {
const { params, state: { offset = 0 } } = getCurrentRoute(getState());
const categoryId = hex2bin(params.categoryId);
const { filters } = action;
dispatch(fetchCategoryProducts({
categoryId,
filters,
offset,
}));
});
}
(state, pattern, categoryId, rootCategories) => {
const decodedCategoryId = categoryId ? hex2bin(categoryId) : null;
if (pattern === ROOT_CATEGORY_PATTERN) {
return createRootCategoryData(rootCategories);
} if (pattern === CATEGORY_PATTERN && decodedCategoryId) {
return createCategoryData(getCategory(state, { categoryId: decodedCategoryId }));
}
return null;
}
);
consumeRenderer = ({ open, id, state }) => {
if (!open) {
return null;
}
const productId = state.productId || hex2bin(id);
return ;
}
(state, pattern, productId) => {
const decodedProductId = productId ? hex2bin(productId) : null;
if (pattern === ITEM_PATTERN && decodedProductId) {
return getProductFormatted(state, { productId: decodedProductId });
}
return null;
}
);
{({ params, visible }) => (
)}
{({ params }) => (
)}
subscribe(categoryFiltersDidUpdate$, ({ action, dispatch, getState }) => {
const { params, state: { offset = 0 } } = getCurrentRoute(getState());
const categoryId = hex2bin(params.categoryId);
const { filters } = action;
dispatch(fetchCategoryProducts({
categoryId,
filters,
offset,
}));
});
}