moduels setigns rmeove from frotneend
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
import { ReactNode, useEffect } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { useSettingsStore } from '../../store/settingsStore';
|
||||
import { isModuleEnabled } from '../../config/modules.config';
|
||||
import { isUpgradeError } from '../../utils/upgrade';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
interface ModuleGuardProps {
|
||||
module: string;
|
||||
@@ -11,31 +7,12 @@ interface ModuleGuardProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* ModuleGuard - Protects routes based on module enable status
|
||||
* Redirects to settings page if module is disabled
|
||||
* ModuleGuard - DEPRECATED
|
||||
* Module enable/disable is now controlled ONLY via Django Admin (GlobalModuleSettings)
|
||||
* This component no longer checks module status - all modules are accessible
|
||||
*/
|
||||
export default function ModuleGuard({ module, children, redirectTo = '/settings/modules' }: ModuleGuardProps) {
|
||||
const { moduleEnableSettings, loadModuleEnableSettings, loading } = useSettingsStore();
|
||||
|
||||
useEffect(() => {
|
||||
// Load module enable settings if not already loaded
|
||||
if (!moduleEnableSettings && !loading) {
|
||||
loadModuleEnableSettings();
|
||||
}
|
||||
}, [moduleEnableSettings, loading, loadModuleEnableSettings]);
|
||||
|
||||
// While loading, show children (optimistic rendering)
|
||||
if (loading || !moduleEnableSettings) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
// Check if module is enabled
|
||||
const enabled = isModuleEnabled(module, moduleEnableSettings as any);
|
||||
|
||||
if (!enabled) {
|
||||
return <Navigate to={redirectTo} replace />;
|
||||
}
|
||||
|
||||
export default function ModuleGuard({ children }: ModuleGuardProps) {
|
||||
// Module filtering removed - all modules always accessible
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user