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:
@@ -478,7 +478,7 @@ function AppRoutes() {
|
||||
{/* Coupons */}
|
||||
<Route path="/coupons" element={<CouponsIndex />} />
|
||||
<Route path="/coupons/new" element={<CouponNew />} />
|
||||
<Route path="/coupons/:id" element={<CouponEdit />} />
|
||||
<Route path="/coupons/:id/edit" element={<CouponEdit />} />
|
||||
|
||||
{/* Customers */}
|
||||
<Route path="/customers" element={<CustomersIndex />} />
|
||||
|
||||
@@ -253,7 +253,7 @@ export default function CouponsIndex() {
|
||||
/>
|
||||
</td>
|
||||
<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}
|
||||
</Link>
|
||||
{coupon.description && (
|
||||
|
||||
Reference in New Issue
Block a user