Improve admin ban UX, add product cloning, and enhance auth handling

Refines the admin ban page with better dialog state management and feedback during ban/unban actions. Adds a product cloning feature to the products dashboard and updates the product table to support cloning. Improves error handling in ChatDetail for authentication errors, and enhances middleware to handle auth check timeouts and network errors more gracefully. Also updates BanUserCard to validate user ID and ensure correct request formatting.
This commit is contained in:
g
2025-12-27 20:58:08 +00:00
parent 2db13cc9b7
commit c9c3f766a6
7 changed files with 153 additions and 43 deletions

View File

@@ -13,9 +13,20 @@ export default function BanUserCard() {
setLoading(true);
setMessage(null);
try {
const userId = parseInt(telegramUserId);
if (isNaN(userId)) {
setMessage("Invalid Telegram User ID");
return;
}
await fetchClient("/admin/ban", {
method: "POST",
body: { telegramUserId, reason }
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
telegramUserId: userId,
reason: reason || undefined
})
});
setMessage("User banned");
setTelegramUserId("");