diff --git a/vendor/magento/module-checkout/view/frontend/web/js/action/redirect-on-success.js b/vendor/magento/module-checkout/view/frontend/web/js/action/redirect-on-success.js index 3c75e3aebf994..a3e1282c41f26 100644 --- a/vendor/magento/module-checkout/view/frontend/web/js/action/redirect-on-success.js +++ b/vendor/magento/module-checkout/view/frontend/web/js/action/redirect-on-success.js @@ -22,6 +22,13 @@ define( */ execute: function () { fullScreenLoader.startLoader(); + this.redirectToSuccessPage(); + }, + + /** + * Redirect to success page. + */ + redirectToSuccessPage: function () { window.location.replace(url.build(this.redirectUrl)); } }; diff --git a/vendor/magento/module-checkout/view/frontend/web/js/model/error-processor.js b/vendor/magento/module-checkout/view/frontend/web/js/model/error-processor.js index bf1697650e762..a916708977873 100644 --- a/vendor/magento/module-checkout/view/frontend/web/js/model/error-processor.js +++ b/vendor/magento/module-checkout/view/frontend/web/js/model/error-processor.js @@ -24,7 +24,13 @@ define([ messageContainer = messageContainer || globalMessageList; if (response.status == 401) { //eslint-disable-line eqeqeq - window.location.replace(url.build('customer/account/login/')); + error = { + message: $t('You are not authorized to access this resource.') + }; + messageContainer.addErrorMessage(error); + setTimeout(() => { + this.redirectTo(url.build('customer/account/login/')); + }, 2000); } else { try { error = JSON.parse(response.responseText); @@ -35,6 +41,13 @@ define([ } messageContainer.addErrorMessage(error); } + }, + + /** + * Method to redirect by requested URL. + */ + redirectTo: function (redirectUrl) { + window.location.replace(redirectUrl); } }; }); diff --git a/vendor/magento/module-theme/etc/adminhtml/di.xml b/vendor/magento/module-theme/etc/adminhtml/di.xml index 8e672cbe1317e..38b1777425772 100644 --- a/vendor/magento/module-theme/etc/adminhtml/di.xml +++ b/vendor/magento/module-theme/etc/adminhtml/di.xml @@ -41,4 +41,7 @@ + + + diff --git a/vendor/magento/module-theme/etc/di.xml b/vendor/magento/module-theme/etc/di.xml index 6ea495e2702ae..8f6415fe18d23 100644 --- a/vendor/magento/module-theme/etc/di.xml +++ b/vendor/magento/module-theme/etc/di.xml @@ -106,9 +106,6 @@ Magento\Store\Model\ScopeInterface::SCOPE_STORE - - - diff --git a/vendor/magento/module-theme/etc/frontend/di.xml b/vendor/magento/module-theme/etc/frontend/di.xml index f0b7f19911e12..af07ca1ff3ebe 100644 --- a/vendor/magento/module-theme/etc/frontend/di.xml +++ b/vendor/magento/module-theme/etc/frontend/di.xml @@ -1,8 +1,8 @@ css/critical.css + + +