This commit is contained in:
seb
2026-09-22 07:20:31 +02:00
parent 536e7b1e2a
commit 5e13b8f9cd
32 changed files with 2485 additions and 1908 deletions

View File

@@ -1,10 +1,6 @@
import { Component } from 'react';
import { connect } from 'react-redux';
import { ActionTile } from '../tiles';
import {
createCategories as createCategoriesThunk,
createCategory as createCategoryThunk,
} from '../../store/categorySlice';
import categoryAutomat from '../../automats/categoryAutomat';
import CategoryNameDialog from './CategoryNameDialog';
class NewCategoryTile extends Component {
@@ -28,10 +24,10 @@ class NewCategoryTile extends Component {
const { parentId } = this.props;
const list = (names ?? []).filter(Boolean);
if (list.length <= 1) {
await this.props.createCategory({ parentId, name: list[0] ?? '' }).unwrap();
await categoryAutomat.actions.createCategory({ parentId, name: list[0] ?? '' });
return;
}
await this.props.createCategories({ parentId, names: list }).unwrap();
await categoryAutomat.actions.createCategories({ parentId, names: list });
}
render() {
@@ -55,9 +51,4 @@ class NewCategoryTile extends Component {
}
}
const mapDispatchToProps = {
createCategory: createCategoryThunk,
createCategories: createCategoriesThunk,
};
export default connect(null, mapDispatchToProps)(NewCategoryTile);
export default NewCategoryTile;