fix(admin): resolve 404 on kategoriProduk API and correct Valtio state endpoint mismatches

- Created missing API endpoint
- Corrected UMKM and Produk update/delete routes in Valtio state to match Elysia API:
  - UMKM Update:
  - UMKM Delete:
  - Produk Update:
  - Produk Delete:
This commit is contained in:
2026-04-24 12:19:24 +08:00
parent 67c51302fe
commit 30fbed73c9
3 changed files with 37 additions and 4 deletions

View File

@@ -132,7 +132,7 @@ export const umkmState = proxy({
if (!cek.success) return toast.error("Cek kembali form anda");
this.loading = true;
try {
const res = await fetch(`/api/ekonomi/umkm/update/${id}`, {
const res = await fetch(`/api/ekonomi/umkm/${id}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(this.form)
@@ -157,7 +157,7 @@ export const umkmState = proxy({
async submit(id: string) {
this.loading = true;
try {
const res = await fetch(`/api/ekonomi/umkm/delete/${id}`, {
const res = await fetch(`/api/ekonomi/umkm/del/${id}`, {
method: "DELETE"
});
const result = await res.json();
@@ -263,7 +263,7 @@ export const umkmState = proxy({
if (!cek.success) return toast.error("Cek kembali form anda");
this.loading = true;
try {
const res = await fetch(`/api/ekonomi/umkm/produk/update/${id}`, {
const res = await fetch(`/api/ekonomi/umkm/produk/${id}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(this.form)
@@ -283,7 +283,7 @@ export const umkmState = proxy({
async submit(id: string) {
this.loading = true;
try {
const res = await fetch(`/api/ekonomi/umkm/produk/delete/${id}`, {
const res = await fetch(`/api/ekonomi/umkm/produk/del/${id}`, {
method: "DELETE"
});
const result = await res.json();