Merge pull request #5138 from devansh-webkul/address-delete-issue

Fixed delete customer address from admin panel in which page is not reloading #5098
This commit is contained in:
Glenn Hermans 2021-09-07 12:55:59 +02:00 committed by GitHub
commit 825b83992d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 7 deletions

View File

@ -172,9 +172,10 @@ class AddressController extends Controller
{
$this->customerAddressRepository->delete($id);
session()->flash('success', trans('admin::app.customers.addresses.success-delete'));
return redirect()->route($this->_config['redirect']);
return response()->json([
'redirect' => false,
'message' => trans('admin::app.customers.addresses.success-delete')
]);
}
/**

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=5fe6e08635de7fcaa890",
"/js/ui.js": "/js/ui.js?id=0e7531d8cbf7818a9acd",
"/css/ui.css": "/css/ui.css?id=87c15a3e7af4ab272377"
}

View File

@ -1459,6 +1459,8 @@
},
doAction: function(e, message, type) {
let self = this;
let element = e.currentTarget;
if (message) {
@ -1474,10 +1476,19 @@
_method: element.getAttribute("data-method")
})
.then(function(response) {
/**
* If refirect is true, then pass redirect url in the response.
*
* Else, it will reload table only.
*/
if (response.data.redirect) {
window.location.href = response.data.redirect;
window.location.href = response.data.redirectUrl;
} else {
location.reload();
self.hitUrl();
window.flashMessages.push({'type': 'alert-success', 'message': response.data.message });
self.$root.addFlashMessages();
}
})
.catch(function(error) {