added toast to unlock handle
This commit is contained in:
parent
d13e1561ae
commit
f4a6ef6150
@ -4,17 +4,30 @@ import { aime_user_game_locks } from "@/prisma/schemas/artemis/generated/artemis
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Trash2, UnlockIcon } from "lucide-react";
|
||||
import { deleteUserGameLocks } from "./action";
|
||||
import { toast } from "@/components/ui/use-toast";
|
||||
type chunithm = aime_user_game_locks & { userName: string | null };
|
||||
|
||||
const handleDelete = async (userId: number) => {
|
||||
try {
|
||||
const result = await deleteUserGameLocks(userId);
|
||||
if (result.success) {
|
||||
console.log(
|
||||
`Successfully deleted ${result.count} rows for user ${userId}.`,
|
||||
);
|
||||
toast({
|
||||
title: "User Unlocked",
|
||||
description: (
|
||||
<pre className="mt-2 w-[340px] rounded-md p-4">
|
||||
<div className="text-white">Successfully unlocked the user</div>
|
||||
</pre>
|
||||
),
|
||||
});
|
||||
} else {
|
||||
console.error(result.message);
|
||||
toast({
|
||||
title: "Failed to unlock user",
|
||||
description: (
|
||||
<pre className="mt-2 w-[340px] rounded-md p-4">
|
||||
<div className="text-white">User has already been unlocked</div>
|
||||
</pre>
|
||||
),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error deleting user game locks:", error);
|
||||
|
Loading…
Reference in New Issue
Block a user