fix: detail categories
This commit is contained in:
commit
a07fd232c6
|
|
@ -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 */}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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}`);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue