Move auth config and build admin menus

Extract NextAuth configuration into a shared library, load admin sidebar items from role permissions, and update related RBAC types and UI.
This commit is contained in:
Ichsan Kurniawan
2026-11-06 18:25:54 +07:00
parent b149903b2e
commit 7f8e6637e4
38 changed files with 406 additions and 239 deletions
@@ -81,9 +81,7 @@ export const RoleForm: FC<Props> = ({ isUpdate, roleId, initialData }) => {
const rawDetails = Array.isArray(initialData.role_detail)
? initialData.role_detail
: Array.isArray(initialData.privilege)
? initialData.privilege
: [];
: [];
rawDetails.forEach((item: any) => {
// Support both new API format (item.menu.id) and legacy format (item.menu_id)
@@ -421,7 +419,7 @@ export const RoleForm: FC<Props> = ({ isUpdate, roleId, initialData }) => {
{/* Bottom Action Bar */}
<div className="mt-6 flex justify-end items-center gap-3">
<Link href="/admin/rbac/user-role">
<Button variant="outline" type="button" disabled={isLoading} className='text-zinc-800! dark:text-white'>
<Button variant="outline" type="button" disabled={isLoading} >
Cancel
</Button>
</Link>
+1 -3
View File
@@ -118,9 +118,7 @@ const ComponentRolePage: FC<Props> = ({ data }) => {
render: (details: any, record: IRole) => {
const count = Array.isArray(details)
? details.length
: Array.isArray(record.privilege)
? record.privilege.length
: 0;
: 0;
return (
<span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-zinc-100 dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300">
{count} menus