add actions

This commit is contained in:
2021-07-17 18:43:21 +03:00
parent 1d228b0669
commit 91b5ddcfaf
16 changed files with 475 additions and 25 deletions

View File

@ -7,15 +7,15 @@ import {CrudService} from '../../services/CrudService';
import {EntityMode} from '../../types/EntityModes';
import {EntityWithId} from '../../api/CrudAPI';
type Props<T> = {
type Options<T> = {
entityListAtom: Atom<T[]>;
service: CrudService<T>;
};
export const createEntityTable = function <T extends EntityWithId<unknown>> ({
export const createEntityTable = function <T> ({
entityListAtom,
service,
}: Props<T>): FC {
}: Options<T>): FC {
return memo(() => {
const entityList = useAtom(entityListAtom);
@ -44,7 +44,7 @@ export const createEntityTable = function <T extends EntityWithId<unknown>> ({
}, [entityList]);
const dataSource = useMemo(() => {
return entityList.map(entity => {
return entityList.map((entity: any) => {
return {
...entity,
key: entity.id,