fix: detail categories

This commit is contained in:
Sabda Yagra 2026-02-10 13:27:38 +07:00
commit a07fd232c6
3 changed files with 23 additions and 17 deletions

View File

@ -39,11 +39,11 @@ export default function CategoriesDetailForm() {
const router = useRouter();
const [detail, setDetail] = useState<CategoryDetail | null>(null);
const [currentUser, setCurrentUser] = useState<CurrentUser | null>(null);
useEffect(() => {
getUserInfo().then((res) => setCurrentUser(res.data.data));
}, []);
useEffect(() => {
async function init() {
if (id) {
@ -125,19 +125,20 @@ export default function CategoriesDetailForm() {
{/* Creator */}
<div>
<Label>Created By</Label>
<Input
readOnly
value={
currentUser && currentUser.id === detail.createdById
? currentUser.fullname || currentUser.username
: `User ID ${detail.createdById}`
}
/>
{/* <Input
type="text"
value={detail.createdByName || detail.createdById}
readOnly
/> */}
<Input
readOnly
value={
currentUser?.id === detail.createdById
? currentUser.username
: `User ID ${detail.createdById}`
}
/>
</div>
{/* Status */}

View File

@ -58,13 +58,13 @@ const columns: ColumnDef<any>[] = [
<span className="normal-case">{row.getValue("userLevelGroup") || "-"}</span>
),
},
{
accessorKey: "statusId",
header: "Status ID",
cell: ({ row }) => (
<span>{row.getValue("statusId")}</span>
),
},
// {
// accessorKey: "statusId",
// header: "Status ID",
// cell: ({ row }) => (
// <span>{row.getValue("statusId")}</span>
// ),
// },
{
accessorKey: "createdAt",
header: "Tanggal Unggah",

View File

@ -3,3 +3,8 @@ import { httpGetInterceptor } from "./http-config/http-interceptor-service";
export function getUserInfo() {
return httpGetInterceptor("users/info");
}
export function getUserById(userId: number) {
return httpGetInterceptor(`users/${userId}`);
}