From 02096e0a43f8aee0abea5016353ec2d79a44e73c Mon Sep 17 00:00:00 2001 From: nisrinasalm Date: Tue, 19 Nov 2024 14:44:36 +0700 Subject: [PATCH] feat: change /product to / --- resources/js/Pages/Product/Show.tsx | 4 ++-- routes/web.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/js/Pages/Product/Show.tsx b/resources/js/Pages/Product/Show.tsx index 696bd0f..8adc1b8 100644 --- a/resources/js/Pages/Product/Show.tsx +++ b/resources/js/Pages/Product/Show.tsx @@ -18,7 +18,7 @@ type FormData = { export default function Show({ product }: { product: ProductType }) { const handleDelete = () => { if (confirm("Are you sure you want to delete this product?")) { - Inertia.delete(`/product/${product.id}/delete`, { + Inertia.delete(`/${product.id}/delete`, { onSuccess: () => toast.success("Product has been deleted."), onError: () => toast.error("Error deleting product."), }); @@ -52,7 +52,7 @@ export default function Show({ product }: { product: ProductType }) {
- + Back
diff --git a/routes/web.php b/routes/web.php index 1914e3b..55fe288 100644 --- a/routes/web.php +++ b/routes/web.php @@ -25,11 +25,11 @@ Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update'); Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy'); - Route::prefix('/product')->group(function () { + Route::prefix('/')->group(function () { Route::get('/', [ProductController::class, 'index'])->name('product.index'); Route::get('/create', [ProductController::class, 'create'])->name('product.create'); Route::post('/store', [ProductController::class, 'store'])->name('product.store'); - Route::get('/{product}', [ProductController::class, 'show'])->name('product.show'); + Route::get('/{product}/detail', [ProductController::class, 'show'])->name('product.show'); Route::get('/{product}/edit', [ProductController::class, 'edit'])->name('product.edit'); Route::post('/{product}/update', [ProductController::class, 'update'])->name('product.update'); Route::delete('/{product}/delete', [ProductController::class, 'destroy'])->name('product.destroy');