feat: fix

This commit is contained in:
2024-11-27 15:44:36 +03:00
parent 431bc35d8b
commit 886eef4c0d
4 changed files with 7 additions and 5 deletions

View File

@@ -8,5 +8,6 @@ export type GetProfitChartDataRequest = {
baseMarketplaceKey: string;
dealStatusId: number;
managerId: number;
tagId: number;
};

View File

@@ -9,6 +9,7 @@ export type GetProfitTableDataRequest = {
baseMarketplaceKey: string;
dealStatusId: number;
managerId: number;
tagId: number;
groupTableBy: ProfitTableGroupBy;
};

View File

@@ -1,11 +1,11 @@
type Props<T, C = void> = {
onCreate: (element: T | C) => void;
type Props<T, C = T> = {
onCreate: (element: C) => void;
onChange: (element: T) => void;
onDelete: (element: T) => void;
};
export function useCRUD<T, C>(props: Props<T, C>) {
const onCreate = (element: T | C) => {
export function useCRUD<T, C = T>(props: Props<T, C>) {
const onCreate = (element: C) => {
props.onCreate(element);
};
const onChange = (element: T) => {

View File

@@ -2,7 +2,7 @@ import { RefObject } from "react";
import { BaseTableRef } from "../components/BaseTable/BaseTable.tsx";
import { MRT_RowData } from "mantine-react-table";
export interface CRUDTableProps<T extends MRT_RowData, C = void> {
export interface CRUDTableProps<T extends MRT_RowData, C extends MRT_RowData = T> {
items: T[];
onCreate?: (item: C | T) => void;
onDelete?: (item: T) => void;