Merge remote-tracking branch 'origin/feature/general'

This commit is contained in:
Ahmed Bouhuolia
2020-04-28 04:40:29 +02:00
24 changed files with 595 additions and 379 deletions

View File

@@ -3,31 +3,31 @@ import {
fetchItemCategories,
submitItemCategory,
deleteItemCategory,
editItemCategory
editItemCategory,
} from 'store/itemCategories/itemsCategory.actions';
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
import { getCategoryId } from 'store/itemCategories/itemsCategory.reducer';
export const mapStateToProps = (state, props) => {
const dialogPayload = getDialogPayload(state, 'item-form');
return {
categories: state.itemCategories.categories,
categoriesList: Object.values(state.itemCategories.categories),
count: 1,
name: 'item-form',
payload: { action: 'new', id: null },
editItemCategory:
dialogPayload && dialogPayload.action === 'edit'
? state.itemCategories.categories[dialogPayload.id]
: {},
getCategoryId: id => getCategoryId(state, id)
getCategoryId: (id) => getCategoryId(state, id),
};
};
export const mapDispatchToProps = dispatch => ({
requestSubmitItemCategory: form => dispatch(submitItemCategory({ form })),
export const mapDispatchToProps = (dispatch) => ({
requestSubmitItemCategory: (form) => dispatch(submitItemCategory({ form })),
requestFetchItemCategories: () => dispatch(fetchItemCategories()),
requestDeleteItemCategory: id => dispatch(deleteItemCategory(id)),
requestEditItemCategory: (id, form) => dispatch(editItemCategory(id, form))
requestDeleteItemCategory: (id) => dispatch(deleteItemCategory(id)),
requestEditItemCategory: (id, form) => dispatch(editItemCategory(id, form)),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -1,4 +1,10 @@
import {connect} from 'react-redux';
import { connect } from 'react-redux';
import {
FetchOption,
FetchOptions,
submitOptions,
} from 'store/settings/settings.actions';
export const mapStateToProps = (state, props) => {
return {
@@ -7,7 +13,8 @@ export const mapStateToProps = (state, props) => {
};
export const mapDispatchToProps = (dispatch) => ({
requestSubmitOptions: (form) => dispatch(submitOptions({ form })),
requestFetchOptions: () => dispatch(FetchOptions({})),
});
export default connect(mapStateToProps, mapDispatchToProps);
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -1,22 +1,20 @@
import {connect} from 'react-redux';
import {
fetchUsers,
fetchUser,
deleteUser,
} from 'store/users/users.actions';
import { connect } from 'react-redux';
import { fetchUsers, fetchUser, deleteUser } from 'store/users/users.actions';
import t from 'store/types';
export const mapStateToProps = (state, props) => ({
usersList: state.users.list
usersList: state.users.list.results,
});
export const mapDispatchToProps = (dispatch) => ({
openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
openDialog: (name, payload) =>
dispatch({ type: t.OPEN_DIALOG, name, payload }),
closeDialog: (name, payload) =>
dispatch({ type: t.CLOSE_DIALOG, name, payload }),
fetchUsers: () => dispatch(fetchUsers({ })),
fetchUsers: () => dispatch(fetchUsers({})),
fetchUser: (id) => dispatch(fetchUser({ id })),
deleteUser: (id) => dispatch(deleteUser({ id })),
});
export default connect(mapStateToProps, mapDispatchToProps);
export default connect(mapStateToProps, mapDispatchToProps);