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
+5 -30
View File
@@ -13,12 +13,7 @@ export function AdminCategoriesProvider({ children }) {
setLoading(true);
try { return await fn(); }
catch (err) {
toast(err?.response?.data?.message ?? "Something went wrong.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast(err?.response?.data?.message ?? "Something went wrong.");
return null;
} finally { setLoading(false); }
}, []);
@@ -37,48 +32,28 @@ export function AdminCategoriesProvider({ children }) {
const createCategory = useCallback((payload) => wrap(async () => {
const { data } = await api.post("/admin/categories", payload);
toast("Category created.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Category created.");
return data.data;
}), [wrap]);
const updateCategory = useCallback((id, payload) => wrap(async () => {
const { data } = await api.put(`/admin/categories/${id}`, payload);
setCategory(data.data ?? null);
toast("Category updated.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Category updated.");
return data.data;
}), [wrap]);
const archiveCategory = useCallback((id) => wrap(async () => {
await api.delete(`/admin/categories/${id}`);
setCategories((prev) => prev.filter((c) => c.id !== id));
toast("Category archived.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Category archived.");
return true;
}), [wrap]);
const restoreCategory = useCallback((id) => wrap(async () => {
await api.post(`/admin/categories/${id}/restore`);
setCategories((prev) => prev.filter((c) => c.id !== id));
toast("Category restored.", {
action: {
label: "Close",
onClick: () => {}
}
});
toast("Category restored.");
return true;
}), [wrap]);