Skip to content

Commit 315aca4

Browse files
committed
ACP2E-2021: Unable to switch to the second store in the front end
- Fixed the issue by revert back the code ACP2E-1445.
1 parent ce96cc5 commit 315aca4

File tree

5 files changed

+6
-143
lines changed

5 files changed

+6
-143
lines changed

app/code/Magento/Customer/Test/Unit/Model/App/FrontController/DeleteCookieWhenCustomerNotExistPluginTest.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

app/code/Magento/Customer/ViewModel/Customer/Data.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

app/code/Magento/Customer/view/frontend/layout/default.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@
4848
</arguments>
4949
</block>
5050
<block name="customer.customer.data" class="Magento\Customer\Block\CustomerData"
51-
template="Magento_Customer::js/customer-data.phtml">
52-
<arguments>
53-
<argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Customer\Data</argument>
54-
</arguments>
55-
</block>
51+
template="Magento_Customer::js/customer-data.phtml"/>
5652
<block name="customer.data.invalidation.rules" class="Magento\Customer\Block\CustomerScopeData"
5753
template="Magento_Customer::js/customer-data/invalidation-rules.phtml"/>
5854
</referenceContainer>

app/code/Magento/Customer/view/frontend/templates/js/customer-data.phtml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,23 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
use Magento\Customer\ViewModel\Customer\Data;
7-
use Magento\Framework\App\ObjectManager;
86

97
/** @var \Magento\Customer\Block\CustomerData $block */
108

119
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
12-
/** @var Data $viewModel */
13-
$viewModel = $block->getViewModel() ?? ObjectManager::getInstance()->get(Data::class);
14-
$customerDataUrl = $block->getCustomerDataUrl('customer/account/updateSession');
15-
$expirableSectionNames = $block->getExpirableSectionNames();
1610
?>
1711
<script type="text/x-magento-init">
1812
{
1913
"*": {
2014
"Magento_Customer/js/customer-data": {
2115
"sectionLoadUrl": "<?= $block->escapeJs($block->getCustomerDataUrl('customer/section/load')) ?>",
2216
"expirableSectionLifetime": <?= (int)$block->getExpirableSectionLifetime() ?>,
23-
"expirableSectionNames": <?= /* @noEscape */ $viewModel->jsonEncode($expirableSectionNames) ?>,
17+
"expirableSectionNames": <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)
18+
->jsonEncode($block->getExpirableSectionNames()) ?>,
2419
"cookieLifeTime": "<?= $block->escapeJs($block->getCookieLifeTime()) ?>",
25-
"updateSessionUrl": "<?= $block->escapeJs($customerDataUrl) ?>",
26-
"isLoggedIn": "<?= /* @noEscape */ $viewModel->isLoggedIn() ?>"
20+
"updateSessionUrl": "<?= $block->escapeJs(
21+
$block->getCustomerDataUrl('customer/account/updateSession')
22+
) ?>"
2723
}
2824
}
2925
}

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,10 @@ define([
4747
* Invalidate Cache By Close Cookie Session
4848
*/
4949
invalidateCacheByCloseCookieSession = function () {
50-
var isLoggedIn = parseInt(options.isLoggedIn, 10) || 0;
51-
5250
if (!$.cookieStorage.isSet('mage-cache-sessid')) {
5351
storage.removeAll();
5452
}
5553

56-
if (!$.localStorage.isSet('mage-customer-login')) {
57-
$.localStorage.set('mage-customer-login', isLoggedIn);
58-
}
59-
if ($.localStorage.get('mage-customer-login') !== isLoggedIn) {
60-
$.localStorage.set('mage-customer-login', isLoggedIn);
61-
storage.removeAll();
62-
}
63-
6454
$.cookieStorage.set('mage-cache-sessid', true);
6555
};
6656

0 commit comments

Comments
 (0)