Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mapStateToProps = state => {
return {
info: getCurrentUser(state)
}
}
const mapDispatchToProps = dispatch => {
return {
updateCurrentUser: (username, roles) => {
dispatch(updateCurrentUser(username, roles))
}
}
}
const UserInfo = withBus(
connect(mapStateToProps, mapDispatchToProps)(UserInfoComponent)
)
export default UserInfo
})
const mergeProps = (stateProps, dispatchProps) => {
return {
...stateProps,
...dispatchProps,
onExportScripts: () => dispatchProps.onExportScripts(stateProps.scripts),
onUpdateFolder: (favorites, payload) =>
dispatchProps.onUpdateFolder(
favorites,
payload,
stateProps.scripts,
stateProps.folders
)
}
}
const Favorites = withBus(
connect(
mapFavoritesStateToProps,
mapFavoritesDispatchToProps,
mergeProps
)(MyScripts)
)
export default Favorites
isStatic: true
}
}
const mapFavoritesDispatchToProps = (dispatch, ownProps) => ({
onSelectScript: favorite =>
ownProps.bus.send(
editor.EDIT_CONTENT,
editor.editContent(favorite.id, favorite.contents)
),
onExecScript: favorite => dispatch(executeCommand(favorite.contents)),
onExportScripts: Function.prototype,
onRemoveScript: Function.prototype,
onUpdateFolder: Function.prototype,
onRemoveFolder: Function.prototype
})
const Favorites = withBus(
connect(mapFavoritesStateToProps, mapFavoritesDispatchToProps)(MyScripts)
)
export default Favorites