delete super admin

This commit is contained in:
Samandar Turgunboyev
2025-12-12 16:39:32 +05:00
parent 92151f4b98
commit 18e43f0eb8
20 changed files with 267 additions and 110 deletions

View File

@@ -1,5 +1,6 @@
import { user_api } from "@/features/users/lib/api";
import type { UserListData, UserListRes } from "@/features/users/lib/data";
import { userStore } from "@/shared/hooks/user";
import { Button } from "@/shared/ui/button";
import { Checkbox } from "@/shared/ui/checkbox";
import {
@@ -43,6 +44,7 @@ const UserTable = ({
currentPage,
}: Props) => {
const queryClient = useQueryClient();
const { user: getme } = userStore();
const [pendingUserId, setPendingUserId] = useState<number | null>(null);
// TableHeader checkbox holati
@@ -182,15 +184,17 @@ const UserTable = ({
>
<Edit className="h-4 w-4" />
</Button>
<Button
variant="destructive"
size="sm"
disabled={sendMessage}
onClick={() => handleDelete(user)}
className="cursor-pointer"
>
<Trash className="h-4 w-4" />
</Button>
{getme?.is_superuser && (
<Button
variant="destructive"
size="sm"
disabled={!getme?.is_superuser || sendMessage}
onClick={() => handleDelete(user)}
className="cursor-pointer"
>
<Trash className="h-4 w-4" />
</Button>
)}
</TableCell>
</TableRow>
))