This commit is contained in:
seb
2026-08-05 08:19:13 +02:00
parent 3000d7d45c
commit a9e942df7a
8 changed files with 417 additions and 155 deletions

View File

@@ -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) {