u
This commit is contained in:
@@ -22,6 +22,7 @@ import Typography from '@mui/material/Typography';
|
||||
import BusinessIcon from '@mui/icons-material/Business';
|
||||
import BackendError from './BackendError';
|
||||
import { company } from '../api';
|
||||
import { StorageManagerContext } from '../api/storageManager';
|
||||
import {
|
||||
createCompany as createCompanyThunk,
|
||||
logout as logoutThunk,
|
||||
@@ -35,6 +36,8 @@ import {
|
||||
import { backendErrorFrom, isBackendFailure } from '../utils/backendError';
|
||||
|
||||
class CompanySetupDialog extends Component {
|
||||
static contextType = StorageManagerContext;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
@@ -73,6 +76,7 @@ class CompanySetupDialog extends Component {
|
||||
this.setState({ busy: true, error: null });
|
||||
try {
|
||||
await this.props.selectCompany(companyId).unwrap();
|
||||
await this.context.updateAuthMe();
|
||||
} catch (err) {
|
||||
this.setState({ error: backendErrorFrom(err) });
|
||||
} finally {
|
||||
@@ -106,6 +110,8 @@ class CompanySetupDialog extends Component {
|
||||
reducedtaxrate: parsedReducedtaxrate,
|
||||
})
|
||||
.unwrap();
|
||||
await this.context.updateAuthMe();
|
||||
await this.context.updateCompany();
|
||||
} catch (err) {
|
||||
this.setState({ error: backendErrorFrom(err) });
|
||||
} finally {
|
||||
@@ -113,8 +119,13 @@ class CompanySetupDialog extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
handleLogout() {
|
||||
void this.props.logout();
|
||||
async handleLogout() {
|
||||
try {
|
||||
await this.props.logout().unwrap();
|
||||
await this.context.updateAuthMe();
|
||||
} catch (err) {
|
||||
this.setState({ error: backendErrorFrom(err) });
|
||||
}
|
||||
}
|
||||
|
||||
handleClose(_event, reason) {
|
||||
|
||||
Reference in New Issue
Block a user