Skip to content

Commit

Permalink
fix: userlist map crash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayllyz committed Jul 24, 2024
1 parent d1f8ca2 commit 10804bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion apps/admin/app/(dashboard)/dashboard/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ function ShowContent() {
<TableHead>Prénom</TableHead>
<TableHead>Nom</TableHead>
<TableHead>Email</TableHead>
<TableHead>Référant</TableHead>
<TableHead>Rôle</TableHead>
<TableHead>Date d'éxpiration</TableHead>
<TableHead>Date de création</TableHead>
Expand Down
7 changes: 3 additions & 4 deletions apps/admin/app/ui/dashboard/users/UserRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,9 @@ function UserRow(user: UserProps) {
<TableCell>{firstName}</TableCell>
<TableCell>{lastName}</TableCell>
<TableCell>{user.email}</TableCell>
<TableCell>TODO</TableCell>
<TableCell>
{roles && roles.length > 0 ? (
roles.map((role) => (
roles?.map((role) => (
<Badge
className="m-[2px]"
key={role.id}
Expand Down Expand Up @@ -214,7 +213,7 @@ function UserRow(user: UserProps) {
username={username}
firstName={firstName}
lastName={lastName}
roles={roles.map((role) => role.id)}
roles={roles?.map((role) => role.id)}
closeDialog={() => setOpenEdit(false)}
setter={setter}
/>
Expand Down Expand Up @@ -255,7 +254,7 @@ function UserRow(user: UserProps) {
<DialogDescription>
<div className="mb-4">Êtes-vous sûr de vouloir supprimer cet utilisateur ?</div>
<div className="flex w-full justify-end gap-4">
<Button variant="destructive" onClick={deleteUser}>
<Button variant="destructive" onClick={deleteUser} disabled={username === 'Supprimé'}>
Supprimer
</Button>
<Button variant="secondary" onClick={() => setOpenDelete(false)}>
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/app/ui/dashboard/users/UsersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import UserRow from '@/app/ui/dashboard/users/UserRow';
function UsersList({ users }: { users: User[] }) {
return (
<>
{users.map((user: User) => (
{users?.map((user: User) => (
<UserRow key={user.id} {...user} />
))}
</>
Expand Down

0 comments on commit 10804bc

Please sign in to comment.