|
|
@@ -22,6 +22,7 @@ const GeneralPerSector: FC = () => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (!userToken) return;
|
|
|
+ setIsLoading(true);
|
|
|
// generalTable(from, to, userToken).then(setData);
|
|
|
generalTable(from, to, userToken).then((res) => {
|
|
|
setData(res);
|
|
|
@@ -95,10 +96,10 @@ const GeneralPerSector: FC = () => {
|
|
|
<table className={`${classes.table}`}>
|
|
|
<Header averageAccumulated mainColumnHeader="Finca" />
|
|
|
{/* Mostrar las filas si hay data */}
|
|
|
- <tbody>{data && rows}</tbody>
|
|
|
+ <tbody>{data && !isLoading && rows}</tbody>
|
|
|
</table>
|
|
|
{/* Si no hay data, mostrar una spinner abajo de la tabla */}
|
|
|
- {!data && isLoading && (
|
|
|
+ {isLoading && (
|
|
|
<div className="d-flex py-3 justify-content-center">
|
|
|
<div className="spinner-border" role="status">
|
|
|
<span className="visually-hidden">Loading...</span>
|