Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
subscribe(favoritesWillRemoveItem$, ({ dispatch, action, getState }) => {
if (getHistoryPathname(getState()) !== FAVORITES_PATH) {
// No toast message when favorites is not active page.
return;
}
// Animations are too fast. This should wait a little bit.
setTimeout(() => {
dispatch(createToast({
action: 'common.undo',
actionOnClick: addFavorites(action.productId),
duration: 2500,
message: 'favorites.removed',
replaceable: true,
}));
}, FAVORITES_SHOW_TOAST_DELAY);
});
}
export const applyFilters = () => (dispatch, getState) => {
dispatch(commitTemporaryFilters());
const path = getHistoryPathname(getState());
if (path.startsWith(`${FILTER_PATH}/`)) {
dispatch(goBackHistory(2));
} else if (path.startsWith(FILTER_PATH)) {
dispatch(goBackHistory(1));
}
};
const getProducts = (offset = 0) => (dispatch, getState) => {
const pathname = getHistoryPathname(getState());
if (pathname.startsWith(CATEGORY_PATH)) {
dispatch(fetchCategoryProducts(offset));
} else if (pathname.startsWith(SEARCH_PATH)) {
dispatch(getSearchResults(offset));
}
};
export const isCurrentViewLoading = state => isViewLoading(state, getHistoryPathname(state));
.filter(({ getState }) => getHistoryPathname(getState()).startsWith(ITEM_PATH))
.merge(successReviewSubmit$);
const mapStateToProps = state => ({
pathname: getHistoryPathname(state),
});
subscribe(requestReviewSubmit$, ({ dispatch, getState }) => {
dispatch(setViewLoading(getHistoryPathname(getState())));
});
subscribe(responseReviewSubmit$, ({ dispatch, getState }) => {
dispatch(unsetViewLoading(getHistoryPathname(getState())));
});
const mapStateToProps = state => ({
navigatorTitle: getTitle(state),
historyPathname: getHistoryPathname(state),
viewTop: getTopStatus(state),
});
const applyFilters = (roundDisplayAmounts = true) => (dispatch, getState) => {
dispatch(commitTemporaryFilters(roundDisplayAmounts));
const path = getHistoryPathname(getState());
if (path.startsWith(`${FILTER_PATH}/`)) {
dispatch(goBackHistory(2));
} else if (path.startsWith(FILTER_PATH)) {
dispatch(goBackHistory(1));
}
};