u
This commit is contained in:
@@ -157,6 +157,9 @@ class CompanySetupDialog extends PureComponent {
|
||||
|
||||
componentDidMount() {
|
||||
this.unsubscribe = companyAutomat.subscribe(this, mapCompanyState);
|
||||
this.unsubscribeAuth = authAutomat.subscribe(this, (state) => ({
|
||||
selectedCompanyId: state.user?.selectedCompanyId ?? null,
|
||||
}));
|
||||
this.setState(mapCompanyState(companyAutomat.state));
|
||||
if (companyAutomat.state.status !== 'succeeded') {
|
||||
void companyAutomat.actions.load().catch(() => {});
|
||||
@@ -165,6 +168,7 @@ class CompanySetupDialog extends PureComponent {
|
||||
|
||||
componentWillUnmount() {
|
||||
this.unsubscribe?.();
|
||||
this.unsubscribeAuth?.();
|
||||
}
|
||||
|
||||
async handleSelect(companyId) {
|
||||
@@ -245,6 +249,10 @@ class CompanySetupDialog extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (authAutomat.state.user?.selectedCompanyId != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const {
|
||||
companies,
|
||||
loading,
|
||||
|
||||
Reference in New Issue
Block a user