mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-20 05:47:43 +00:00
feat(user): implement user update functionality and enhance verification page UI ✨
This commit is contained in:
@ -1,3 +1,19 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/app/auth";
|
||||
import ClientErrorMessage from "@/components/client-error-message";
|
||||
import UserUpdateForm from "@/components/user/user-update-form";
|
||||
import { getProfileById } from "@/queries/users";
|
||||
import { tryCatch } from "@/utils/tryCatch";
|
||||
// import {
|
||||
// Select,
|
||||
// SelectContent,
|
||||
// SelectGroup,
|
||||
// SelectItem,
|
||||
// SelectLabel,
|
||||
// SelectTrigger,
|
||||
// SelectValue,
|
||||
// } from "@/components/ui/select";
|
||||
|
||||
export default async function UserUpdate({
|
||||
params,
|
||||
@ -7,8 +23,25 @@ export default async function UserUpdate({
|
||||
}>;
|
||||
}) {
|
||||
const { userId } = await params;
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.is_admin) return null
|
||||
const [error, user] = await tryCatch(getProfileById(userId));
|
||||
|
||||
|
||||
if (error) {
|
||||
if (error.message === "UNAUTHORIZED") {
|
||||
redirect("/auth/signin");
|
||||
} else {
|
||||
return <ClientErrorMessage message={error.message} />;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div>UserUpdate: {userId}</div>
|
||||
)
|
||||
<div>
|
||||
<div className="flex items-center justify-between text-gray-500 text-2xl font-bold title-bg py-4 px-2 mb-4">
|
||||
<h3 className="text-sarLinkOrange text-2xl">Verify user</h3>
|
||||
</div>
|
||||
<UserUpdateForm user={user} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user