Fix loading error. Hide existing content and then show loading

This commit is contained in:
Vikas Nale 2025-04-17 17:52:09 +05:30
parent 1418f84976
commit b963f6bad9

View File

@ -34,7 +34,9 @@ const Regularization = ({ handleRequest }) => {
</thead> </thead>
<tbody> <tbody>
{loading && <td colSpan={5}>Loading...</td>} {loading && <td colSpan={5}>Loading...</td>}
{regularizes?.length > 0 ? (
{!loading &&
(regularizes?.length > 0 ? (
regularizes?.map((att, index) => ( regularizes?.map((att, index) => (
<tr key={index}> <tr key={index}>
<td colSpan={2}> <td colSpan={2}>
@ -55,7 +57,9 @@ const Regularization = ({ handleRequest }) => {
<td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td> <td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td>
<td>{convertShortTime(att.checkInTime)}</td> <td>{convertShortTime(att.checkInTime)}</td>
<td> <td>
{att.checkOutTime ? convertShortTime(att.checkOutTime) : "--"} {att.checkOutTime
? convertShortTime(att.checkOutTime)
: "--"}
</td> </td>
<td className="text-center "> <td className="text-center ">
{/* <div className='d-flex justify-content-center align-items-center gap-3'> */} {/* <div className='d-flex justify-content-center align-items-center gap-3'> */}
@ -72,7 +76,7 @@ const Regularization = ({ handleRequest }) => {
<tr> <tr>
<td colSpan={5}>No Record Found</td> <td colSpan={5}>No Record Found</td>
</tr> </tr>
)} ))}
</tbody> </tbody>
</table> </table>
</div> </div>