refactor: Standardize edit routes to /{entity}/{id}/edit

Consistency fix: All edit routes now follow same pattern

Before:
- Products: /products/123/edit 
- Orders: /orders/123/edit 
- Coupons: /coupons/123  (inconsistent)

After:
- Products: /products/123/edit 
- Orders: /orders/123/edit 
- Coupons: /coupons/123/edit  (now consistent)

Changes:
1. App.tsx - Route: /coupons/:id → /coupons/:id/edit
2. Coupons/index.tsx - Link: /coupons/${id} → /coupons/${id}/edit

Benefits:
 Consistent URL pattern across all entities
 Clear intent (edit vs detail)
 Easier to add detail pages later if needed
 Follows REST conventions

Note: Even though coupons/products have no detail page in admin,
using /edit suffix maintains consistency and allows future expansion.
This commit is contained in:
dwindown
2025-11-20 22:33:21 +07:00
parent fe545a480d
commit 3ed2a081e5
2 changed files with 2 additions and 2 deletions

View File

@@ -478,7 +478,7 @@ function AppRoutes() {
{/* Coupons */} {/* Coupons */}
<Route path="/coupons" element={<CouponsIndex />} /> <Route path="/coupons" element={<CouponsIndex />} />
<Route path="/coupons/new" element={<CouponNew />} /> <Route path="/coupons/new" element={<CouponNew />} />
<Route path="/coupons/:id" element={<CouponEdit />} /> <Route path="/coupons/:id/edit" element={<CouponEdit />} />
{/* Customers */} {/* Customers */}
<Route path="/customers" element={<CustomersIndex />} /> <Route path="/customers" element={<CustomersIndex />} />

View File

@@ -253,7 +253,7 @@ export default function CouponsIndex() {
/> />
</td> </td>
<td className="p-3"> <td className="p-3">
<Link to={`/coupons/${coupon.id}`} className="font-medium hover:underline"> <Link to={`/coupons/${coupon.id}/edit`} className="font-medium hover:underline">
{coupon.code} {coupon.code}
</Link> </Link>
{coupon.description && ( {coupon.description && (