🐛 fix(ApiKeysPage): handle cases where keysList.current is null or undefined to prevent errors

✨ feat(ApiKeysPage): add conditional rendering for keysList.current to display appropriate messages when there are no keys assigned or when loading keys
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-27 19:54:59 -03:00
commit b70d5501a2

View file

@ -103,11 +103,14 @@ export default function ApiKeysPage() {
<div className="flex items-center space-x-2"></div> <div className="flex items-center space-x-2"></div>
</div> </div>
{keysList.current.length === 0 && !loadingKeys && ( {keysList.current &&
keysList.current.length === 0 &&
!loadingKeys && (
<> <>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h2> <h2>
This user does not have any keys assigned at the moment. This user does not have any keys assigned at the
moment.
</h2> </h2>
</div> </div>
</> </>
@ -124,7 +127,9 @@ export default function ApiKeysPage() {
(loadingKeys ? " border-0" : "") (loadingKeys ? " border-0" : "")
} }
> >
{keysList.current.length > 0 && !loadingKeys && ( {keysList.current &&
keysList.current.length > 0 &&
!loadingKeys && (
<Table className={"table-fixed bg-muted outline-1"}> <Table className={"table-fixed bg-muted outline-1"}>
<TableHeader <TableHeader
className={ className={