mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
refactoring: setup wizard pages with simple architecture.
This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Redirect } from 'react-router-dom';
|
||||
import { compose } from 'utils';
|
||||
import withAuthentication from 'containers/Authentication/withAuthentication';
|
||||
import withOrganizationByOrgId from 'containers/Organization/withOrganizationByOrgId';
|
||||
|
||||
export default function EnsureOrganizationIsReady({
|
||||
function EnsureOrganizationIsReady({
|
||||
// #ownProps
|
||||
children,
|
||||
}) {
|
||||
const isOrganizationReady = false;
|
||||
redirectTo = '/setup',
|
||||
|
||||
return (isOrganizationReady) ? children : (
|
||||
// #withOrganizationByOrgId
|
||||
organization,
|
||||
}) {
|
||||
return (organization.is_ready) ? children : (
|
||||
<Redirect
|
||||
to={{
|
||||
pathname: '/register'
|
||||
}}
|
||||
to={{ pathname: redirectTo }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withAuthentication(),
|
||||
connect((state, props) => ({
|
||||
organizationId: props.currentOrganizationId,
|
||||
})),
|
||||
withOrganizationByOrgId(),
|
||||
)(EnsureOrganizationIsReady);
|
||||
Reference in New Issue
Block a user