Fix jwt-token
This commit is contained in:
@@ -17,40 +17,6 @@ import {
|
|||||||
} from '@heroicons/react/24/outline';
|
} from '@heroicons/react/24/outline';
|
||||||
import { hasPermission, canAccessSettings } from '../utils/rbac';
|
import { hasPermission, canAccessSettings } from '../utils/rbac';
|
||||||
|
|
||||||
// Define tabs outside component to ensure stability
|
|
||||||
const ALL_TABS = [
|
|
||||||
{
|
|
||||||
id: 'general',
|
|
||||||
name: 'General',
|
|
||||||
icon: CogIcon,
|
|
||||||
permission: 'tenant.view'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'branding',
|
|
||||||
name: 'Branding',
|
|
||||||
icon: PaintBrushIcon,
|
|
||||||
permission: 'branding.view'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'security',
|
|
||||||
name: 'Security',
|
|
||||||
icon: ShieldCheckIcon,
|
|
||||||
permission: 'security.view'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'authentication',
|
|
||||||
name: 'Authentication',
|
|
||||||
icon: KeyIcon,
|
|
||||||
permission: 'auth.view'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'users',
|
|
||||||
name: 'Users',
|
|
||||||
icon: UserGroupIcon,
|
|
||||||
permission: 'users.view'
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const Settings = () => {
|
const Settings = () => {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -58,8 +24,8 @@ const Settings = () => {
|
|||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
|
|
||||||
// Define tabs with translations inside component
|
// Define tabs with translations inside component after useTranslation hook
|
||||||
const ALL_TABS = [
|
const allTabs = [
|
||||||
{
|
{
|
||||||
id: 'general',
|
id: 'general',
|
||||||
name: t('settings.general'),
|
name: t('settings.general'),
|
||||||
@@ -94,7 +60,7 @@ const Settings = () => {
|
|||||||
|
|
||||||
// Calculate available tabs
|
// Calculate available tabs
|
||||||
const availableTabs = user?.role
|
const availableTabs = user?.role
|
||||||
? ALL_TABS.filter(tab => hasPermission(user.role, tab.permission))
|
? allTabs.filter(tab => hasPermission(user.role, tab.permission))
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
// Set active tab - default to first available or general
|
// Set active tab - default to first available or general
|
||||||
|
|||||||
Reference in New Issue
Block a user