testing 127.0.0.1 issue

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-07 13:40:07 +08:00
parent 244aa607f7
commit 6624c0d27f
62 changed files with 662 additions and 1889 deletions
@@ -248,12 +248,7 @@ export default function CourseAssessment() {
setLocalAssessment(result);
} catch (err) {
if (err?.response?.status !== 404) {
toast(err?.response?.data?.message ?? "Could not load assessment.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Could not load assessment.");
}
} finally {
setInitializing(false);
@@ -290,7 +290,7 @@ export default function EditCourse() {
const handleSaveCategories = async () => {
setCategoriesLoading(true);
await syncCourseCategories(courseId, selectedCategoryIds.map(Number));
await syncCourseCategories(courseId, selectedCategoryIds);
setCategoriesDirty(false);
setCategoriesLoading(false);
};
@@ -355,12 +355,7 @@ export default function ViewAssessment() {
setLocalAssessment(data?.data?.data ?? null);
} catch (err) {
if (err?.response?.status !== 404) {
toast(err?.response?.data?.message ?? "Could not load assessment.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Could not load assessment.");
}
}
})();
@@ -240,12 +240,7 @@ export default function ModifyQuiz() {
setLocalQuiz(result);
} catch (err) {
if (err?.response?.status !== 404) {
toast(err?.response?.data?.message ?? "Could not load quiz.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Could not load quiz.");
}
// 404 → no quiz yet, stay in create mode with localQuiz = null
} finally {
@@ -41,12 +41,7 @@ export default function NotificationSettings() {
const { data } = await api.get("/admin/notification-settings");
setSettings(data?.data ?? []);
} catch (err) {
toast(err?.response?.data?.message ?? "Failed to load notification settings.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Failed to load notification settings.");
} finally {
setLoading(false);
}
@@ -64,21 +59,10 @@ export default function NotificationSettings() {
const updated = data?.data?.data;
setSettings((prev) => prev.map((s) => (s.job_name === jobName ? { ...s, ...updated } : s)));
toast(
`${JOB_LABELS[jobName]?.label ?? jobName} ${enabled ? "enabled" : "disabled"}.`,
{
action: {
label: "Close",
onClick: () => {}
}
}
`${JOB_LABELS[jobName]?.label ?? jobName} ${enabled ? "enabled" : "disabled"}.`
);
} catch (err) {
toast(err?.response?.data?.message ?? "Failed to update setting.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Failed to update setting.");
} finally {
setSavingJob(null);
}
@@ -93,19 +77,9 @@ export default function NotificationSettings() {
});
const updated = data?.data?.data;
setSettings((prev) => prev.map((s) => (s.job_name === jobName ? { ...s, ...updated, preset } : s)));
toast("Schedule updated — took effect immediately, no restart needed.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Schedule updated — took effect immediately, no restart needed.");
} catch (err) {
toast(err?.response?.data?.message ?? "Failed to update schedule.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Failed to update schedule.");
} finally {
setSavingJob(null);
}
@@ -100,20 +100,10 @@ export default function PaymentPolicy() {
},
promo_rules: promoRules,
});
toast("Payment policy saved.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Payment policy saved.");
navigate("/admin/tiers/plans");
} catch (err) {
toast(err?.response?.data?.message ?? "Could not save payment policy.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Could not save payment policy.");
} finally {
setSaving(false);
}
@@ -123,25 +113,10 @@ export default function PaymentPolicy() {
const handleAddPromo = () => {
const code = addForm.code.trim().toUpperCase();
if (!code) { toast("Code is required.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast("Value must be greater than 0.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (!code) { toast("Code is required."); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast("Value must be greater than 0."); return; }
if (promoRules.some((r) => r.code.toUpperCase() === code)) {
toast("A rule with this code already exists.", {
action: {
label: "Close",
onClick: () => {}
}
}); return;
toast("A rule with this code already exists."); return;
}
const rule = {
+5 -30
View File
@@ -220,19 +220,9 @@ function PaymentPolicyTab({ planId, plan }) {
},
promo_rules: promoRules,
});
toast("Payment policy saved.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Payment policy saved.");
} catch (err) {
toast(err?.response?.data?.message ?? "Could not save payment policy.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Could not save payment policy.");
} finally {
setSaving(false);
}
@@ -240,24 +230,9 @@ function PaymentPolicyTab({ planId, plan }) {
const handleAddPromo = () => {
const code = addForm.code.trim().toUpperCase();
if (!code) { toast("Code is required.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast("Value must be greater than 0.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (promoRules.some((r) => r.code.toUpperCase() === code)) { toast("A rule with this code already exists.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (!code) { toast("Code is required."); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast("Value must be greater than 0."); return; }
if (promoRules.some((r) => r.code.toUpperCase() === code)) { toast("A rule with this code already exists."); return; }
const rule = {
code,
+2 -12
View File
@@ -151,20 +151,10 @@ export default function EditUser() {
const res = await updateUser(id, payload);
if (res) {
toast("User updated successfully.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("User updated successfully.");
navigate(`../view/${id}`);
} else {
toast("Failed to update user.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Failed to update user.");
}
};