This commit is contained in:
seb
2026-10-04 21:04:40 +02:00
parent 669954b496
commit f765b87336
59 changed files with 1491 additions and 2045 deletions

View File

@@ -2,7 +2,9 @@ import { PureComponent } from 'react';
import { enqueueSnackbar } from 'notistack';
import BackendError from '../components/BackendError';
import { RecordList } from 'dashgui/lists';
import { StorageManagerContext } from '../api/storageManagerContext';
import { entity as entityApi } from '../api';
import entityAutomat from '../automats/entityAutomat';
import customergroupAutomat from '../automats/customergroupAutomat';
import { router } from '../appRouter';
import { backendErrorFrom } from '../utils/backendError';
import { notifyError } from '../utils/notify';
@@ -21,8 +23,6 @@ function formatDate(value) {
}
class KundeListePage extends PureComponent {
static contextType = StorageManagerContext;
constructor(props) {
super(props);
this.state = {
@@ -50,8 +50,8 @@ class KundeListePage extends PureComponent {
this.setState({ status: 'loading', error: null });
try {
const [entities, groups] = await Promise.all([
this.context.entities ?? this.context.entityPromise,
this.context.customergroups ?? this.context.customergroupPromise,
entityAutomat.actions.ensureLoaded(),
customergroupAutomat.actions.ensureLoaded(),
]);
if (this._cancelled) return;
const groupsById = Object.fromEntries(groups.map((row) => [row.id, row]));
@@ -89,8 +89,8 @@ class KundeListePage extends PureComponent {
this.setState({ busyId: entity.id });
try {
await this.context.entity.delete(entity.id);
const list = await this.context.updateEntity();
await entityApi.delete(entity.id);
const list = await entityAutomat.actions.reload();
if (this._cancelled) return;
this.setState({
entities: sortEntities(list),