Delete Message Fixed
This commit is contained in:
parent
a9daa3532c
commit
4b70fe3b23
|
|
@ -153,7 +153,7 @@ class SliderController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete the slider item and preserve the last one from deleting.
|
||||
* Delete the slider item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
|
|
@ -165,13 +165,15 @@ class SliderController extends Controller
|
|||
try {
|
||||
$this->sliderRepository->delete($id);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Slider']));
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
return response()->json([
|
||||
'message' => trans('admin::app.response.delete-success', ['name' => 'Slider']),
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Slider']));
|
||||
report($e);
|
||||
}
|
||||
|
||||
return response()->json(['message' => false], 400);
|
||||
return response()->json([
|
||||
'message' => trans('admin::app.response.delete-failed', ['name' => 'Slider']),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,20 +352,20 @@ class ProductController extends Controller
|
|||
try {
|
||||
$this->productRepository->delete($id);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Product']));
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
return response()->json([
|
||||
'message' => trans('admin::app.response.delete-success', ['name' => 'Product']),
|
||||
], 200);
|
||||
} catch (Exception $e) {
|
||||
report($e);
|
||||
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Product']));
|
||||
}
|
||||
|
||||
return response()->json(['message' => false], 400);
|
||||
return response()->json([
|
||||
'message' => trans('admin::app.response.delete-failed', ['name' => 'Product']),
|
||||
], 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mass Delete the products.
|
||||
* Mass delete the products.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
|
@ -387,7 +387,7 @@ class ProductController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Mass updates the products.
|
||||
* Mass update the products.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=5fe92e022be45ac4802b",
|
||||
"/js/ui.js": "/js/ui.js?id=944a9430215bab88307c",
|
||||
"/css/ui.css": "/css/ui.css?id=57354f5eea4eb6f616e9"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1574,7 +1574,14 @@ export default {
|
|||
}
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log(error);
|
||||
let response = error.response;
|
||||
|
||||
window.flashMessages.push({
|
||||
type: 'alert-error',
|
||||
message: response.data.message ?? 'Something went wrong!'
|
||||
});
|
||||
|
||||
self.$root.addFlashMessages();
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
|
|
|
|||
Loading…
Reference in New Issue