Compare commits

..

No commits in common. "fix/plans-refresh-after-create" and "main" have entirely different histories.

1 changed files with 6 additions and 10 deletions

View File

@ -763,17 +763,13 @@ export default function App() {
{ headers: { Authorization: `Bearer ${userToken}` } } { headers: { Authorization: `Bearer ${userToken}` } }
); );
const plansRes = await axios.get(`${API_BASE}/api/admin/plans`, { if (res.data?.plan) {
headers: { Authorization: `Bearer ${userToken}` }, setAdminPlansList((prev) => [res.data.plan, ...prev]);
});
if (Array.isArray(plansRes.data)) {
setAdminPlansList(plansRes.data);
}
const createdCode = res.data?.base_code || createPlanCode.trim().toUpperCase();
setAdminLogs((prev) => [ setAdminLogs((prev) => [
`[Plans] Created custom plan '${createPlanName.trim()}' (${createdCode})`, `[Plans] Created custom plan '${res.data.plan.name}' (${res.data.plan.base_code})`,
...prev, ...prev,
]); ]);
}
setShowCreatePlanModal(false); setShowCreatePlanModal(false);
} catch (err: any) { } catch (err: any) {
setCreatePlanError(extractErrorMessage(err, 'Failed to create custom plan.')); setCreatePlanError(extractErrorMessage(err, 'Failed to create custom plan.'));