generated from Luis/nextjs-python-web-template
Stash changes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useGetEntities } from "@/api/entities/entities";
|
||||
import { useGetAllEntities } from "@/api/entities/entities";
|
||||
import { Entity } from "@/api/model";
|
||||
import { AxiosError } from "axios";
|
||||
import React, {
|
||||
@@ -33,7 +33,7 @@ interface AppContextProviderProps {
|
||||
export const WithAppState = (props: AppContextProviderProps) => {
|
||||
const { children } = props;
|
||||
|
||||
const { data: entityData, swrKey: entitiesKeyFunc } = useGetEntities();
|
||||
const { data: entityData, swrKey: entitiesKeyFunc } = useGetAllEntities();
|
||||
|
||||
const isLoading = false;
|
||||
const error = undefined;
|
||||
|
||||
@@ -35,13 +35,13 @@ const menuEntityEntries: MenuEntry[] = [
|
||||
{
|
||||
icon: <PersonIcon />,
|
||||
label: "C1",
|
||||
to: "/client-1",
|
||||
to: "/client/C1",
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
icon: <PersonIcon />,
|
||||
label: "C2",
|
||||
to: "/client-2",
|
||||
to: "/client/C2",
|
||||
disabled: false,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -11,7 +11,7 @@ import { StyledTableCell, StyledTableRow } from "./style";
|
||||
import { ICustomTable, CustomTableConfiguration } from "@/types";
|
||||
import { Checkbox, Skeleton } from "@mui/material";
|
||||
|
||||
const CustomTable = ({ configuration, data, loading }: ICustomTable) => {
|
||||
const CustomTable = ({ configuration, data, loading, key }: ICustomTable) => {
|
||||
if (loading)
|
||||
return <Skeleton variant="rectangular" animation="wave" height={200} />;
|
||||
|
||||
@@ -25,7 +25,7 @@ const CustomTable = ({ configuration, data, loading }: ICustomTable) => {
|
||||
render?: (param: any) => void | undefined,
|
||||
) => {
|
||||
let renderedValue = value;
|
||||
|
||||
console.log(cellKey)
|
||||
// cover use case if the data is an array
|
||||
if (Array.isArray(value)) renderedValue = value.join(", ");
|
||||
|
||||
@@ -56,11 +56,11 @@ const CustomTable = ({ configuration, data, loading }: ICustomTable) => {
|
||||
<TableBody>
|
||||
{data.map((data: any, rowIndex: number) => (
|
||||
<StyledTableRow key={rowIndex}>
|
||||
{configuration.map((column: CustomTableConfiguration) => {
|
||||
{configuration.map((column: CustomTableConfiguration, columnIndex: number) => {
|
||||
const cellValue: any = data[column.key];
|
||||
const cellKey = column.key;
|
||||
const cellKey = key + ":" + column.key + ":" + rowIndex;
|
||||
const renderComponent = column?.render;
|
||||
return renderTableCell(cellValue, cellKey, renderComponent);
|
||||
return renderTableCell(cellValue, cellKey + ":" + columnIndex, renderComponent);
|
||||
})}
|
||||
</StyledTableRow>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user