no redux
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user