fix(umkm): fix TypeError, 404 API URL, and Recharts warnings

This commit is contained in:
2026-04-21 12:23:22 +08:00
parent ece84fabf0
commit a2d157ee02
8 changed files with 86 additions and 15 deletions

View File

@@ -0,0 +1,20 @@
# Summary: UMKM Module Bug Fixes
## Changes Made:
1. **Fixed TypeError in UMKM/Pasar Desa Public Page**:
- Modified `src/app/darmasaba/(pages)/ekonomi/pasar-desa/page.tsx` to stop destructuring the `load` method from the Valtio proxy.
- Called `load` directly via `pasarDesaState` or `umkmState` to preserve `this` binding.
- Cleaned up unused imports (`Group`, `IconTag`).
2. **Fixed 404 API URL for Category Products**:
- Corrected the URL in `src/app/admin/(dashboard)/_state/ekonomi/umkm/umkm.ts` from `/api/ekonomi/pasar-desa/kategori-produk/find-many-all` to `/api/ekonomi/kategoriproduk/find-many-all`.
- Removed unused `Prisma` import.
3. **Resolved Recharts Warning and Improved Dashboard**:
- Added a `BarChart` to the UMKM Admin Dashboard (`src/app/admin/(dashboard)/ekonomi/umkm/dashboard/page.tsx`) to show sales trends by product.
- Wrapped the chart in a `ResponsiveContainer` and provided an explicit height of 350px on the parent `Box`.
- Fixed a compilation error in `src/app/darmasaba/(pages)/ekonomi/umkm/[id]/page.tsx` by adding the missing `Center` import.
## Verification:
- Ran `bun run build` successfully with no compile errors.
- Verified that all three bugs are addressed based on code analysis and build success.