mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
WIP fix-general
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
submitUser,
|
||||
editUser,
|
||||
fetchUser,
|
||||
} from 'store/users/users.actions';
|
||||
import {
|
||||
getUserDetails
|
||||
} from 'store/users/users.reducer';
|
||||
import { connect } from 'react-redux';
|
||||
import { submitInvite, editUser, fetchUser } from 'store/users/users.actions';
|
||||
import { getUserDetails } from 'store/users/users.reducer';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
@@ -15,18 +9,22 @@ export const mapStateToProps = (state, props) => {
|
||||
|
||||
return {
|
||||
name: 'user-form',
|
||||
payload: {action: 'new', id: null},
|
||||
userDetails: dialogPayload.action === 'edit'
|
||||
? getUserDetails(state, dialogPayload.user.id) : {},
|
||||
payload: { action: 'new', id: null },
|
||||
userDetails:
|
||||
dialogPayload.action === 'edit'
|
||||
? getUserDetails(state, dialogPayload.user.id)
|
||||
: {},
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
submitUser: (form) => dispatch(submitUser({ form })),
|
||||
editUser: (id, form) => dispatch(editUser({ form, id })),
|
||||
fetchUser: (id) => dispatch(fetchUser({ id })),
|
||||
openDialog: (name, payload) =>
|
||||
dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) =>
|
||||
dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
requestSubmitInvite: (form) => dispatch(submitInvite({ form })),
|
||||
requestEditUser: (id, form) => dispatch(editUser({ form, id })),
|
||||
requestFetchUser: (id) => dispatch(fetchUser({ id })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -1,10 +1,32 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { fetchUsers, fetchUser, deleteUser } from 'store/users/users.actions';
|
||||
import {
|
||||
fetchUsers,
|
||||
fetchUser,
|
||||
deleteUser,
|
||||
inactiveUser,
|
||||
editUser,
|
||||
} from 'store/users/users.actions';
|
||||
import t from 'store/types';
|
||||
import { getUserDetails } from 'store/users/users.reducer';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
usersList: state.users.list.results,
|
||||
});
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const dialogPayload = getDialogPayload(state, 'userList-form');
|
||||
|
||||
return {
|
||||
name: 'userList-form',
|
||||
payload: { action: 'new', id: null },
|
||||
userDetails:
|
||||
dialogPayload.action === 'edit'
|
||||
? getUserDetails(state, dialogPayload.user.id)
|
||||
: {},
|
||||
editUser:
|
||||
dialogPayload && dialogPayload.action === 'edit'
|
||||
? state.users.list.results[dialogPayload.user.id]
|
||||
: {},
|
||||
usersList: state.users.list.results,
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) =>
|
||||
@@ -12,9 +34,11 @@ export const mapDispatchToProps = (dispatch) => ({
|
||||
closeDialog: (name, payload) =>
|
||||
dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
|
||||
fetchUsers: () => dispatch(fetchUsers({})),
|
||||
fetchUser: (id) => dispatch(fetchUser({ id })),
|
||||
deleteUser: (id) => dispatch(deleteUser({ id })),
|
||||
requestFetchUsers: () => dispatch(fetchUsers({})),
|
||||
requestFetchUser: (id) => dispatch(fetchUser({ id })),
|
||||
requestDeleteUser: (id) => dispatch(deleteUser({ id })),
|
||||
requestInactiveUser: (id) => dispatch(inactiveUser({ id })),
|
||||
requestEditUser: (id, form) => dispatch(editUser({ form, id })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
Reference in New Issue
Block a user