fix: allow owner role to access admin pages

This commit is contained in:
dyzulk
2025-12-30 20:14:39 +07:00
parent e64df76835
commit e7c02d5fa1
8 changed files with 63 additions and 14 deletions

View File

@@ -33,9 +33,9 @@ export default function UsersManagementClient() {
const { data, error, mutate, isLoading } = useSWR("/api/admin/users", fetcher);
const hasAdminAccess = ['admin', 'owner'].includes(currentUser?.role || '');
const isOwner = currentUser?.role === "owner";
const isAdmin = currentUser?.role === "admin";
const { isAdmin, isOwner, isAdminOrOwner } = useAuth();
const hasAdminAccess = isAdminOrOwner;
const handleDelete = async (id: string) => {
setIsDeleting(true);