mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat: register pages routes guards.
feat: retrieve all organizations details to authenticated user. feat: redux organization reducers and actions.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
fetchOrganizations,
|
||||
} from 'store/organizations/organizations.actions';
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestOrganizationsList: () => dispatch(fetchOrganizations()),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
@@ -0,0 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
getOrganizationByOrgIdFactory,
|
||||
} from 'store/organizations/organizations.selector';
|
||||
|
||||
export default (mapState) => {
|
||||
const getOrganizationByOrgId = getOrganizationByOrgIdFactory();
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
const mapped = {
|
||||
organization: getOrganizationByOrgId(state, props),
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
return connect(mapStateToProps);
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
getOrganizationByTenantIdFactory,
|
||||
} from 'store/organizations/organizations.selector';
|
||||
|
||||
export default (mapState) => {
|
||||
const getOrgByTenId = getOrganizationByTenantIdFactory();
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
const mapped = {
|
||||
organization: getOrgByTenId(state, props),
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
return connect(mapStateToProps);
|
||||
};
|
||||
Reference in New Issue
Block a user