Compare commits
No commits in common. "56cb400c19b0348a595fb71aa0a2a67ff62cb18f" and "2cb277ee9883ec0317991e14d2af7533f448df1e" have entirely different histories.
56cb400c19
...
2cb277ee98
25
src/App.tsx
25
src/App.tsx
|
|
@ -459,30 +459,6 @@ export default function App() {
|
||||||
{ is_active: newActive, status: newStatus },
|
{ is_active: newActive, status: newStatus },
|
||||||
{ headers: { Authorization: `Bearer ${userToken}` } }
|
{ headers: { Authorization: `Bearer ${userToken}` } }
|
||||||
);
|
);
|
||||||
|
|
||||||
const linkedPlans = adminPlansList.filter((p) =>
|
|
||||||
p.base_code?.toLowerCase() === mod.code?.toLowerCase() ||
|
|
||||||
p.module_ids?.includes(mod.id) ||
|
|
||||||
p.modules?.some((m: any) => m.id === mod.id || m.slug === mod.slug)
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const plan of linkedPlans) {
|
|
||||||
if (plan.is_active !== newActive) {
|
|
||||||
try {
|
|
||||||
await axios.patch(
|
|
||||||
`${API_BASE}/api/admin/plans/${plan.base_code}/status`,
|
|
||||||
{ is_active: newActive },
|
|
||||||
{ headers: { Authorization: `Bearer ${userToken}` } }
|
|
||||||
);
|
|
||||||
setAdminPlansList((prev) =>
|
|
||||||
prev.map((p) => (p.base_code === plan.base_code ? { ...p, is_active: newActive } : p))
|
|
||||||
);
|
|
||||||
} catch (planErr) {
|
|
||||||
console.error('Failed to sync linked plan status:', planErr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setAdminLogs((prev) => [`[Catalog] ${mod.name} is now ${newActive ? 'Active' : 'Inactive'}`, ...prev]);
|
setAdminLogs((prev) => [`[Catalog] ${mod.name} is now ${newActive ? 'Active' : 'Inactive'}`, ...prev]);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setAdminModulesList((prev) =>
|
setAdminModulesList((prev) =>
|
||||||
|
|
@ -492,7 +468,6 @@ export default function App() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleOpenEditModule = (mod: any) => {
|
const handleOpenEditModule = (mod: any) => {
|
||||||
setSelectedEditModule(mod);
|
setSelectedEditModule(mod);
|
||||||
setEditModuleName(mod.name || '');
|
setEditModuleName(mod.name || '');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue