mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 22:06:28 +00:00
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:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user