File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
app/code/Magento/Customer/view/frontend Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ var config = {
14
14
addressValidation : 'Magento_Customer/js/addressValidation' ,
15
15
showPassword : 'Magento_Customer/js/show-password' ,
16
16
'Magento_Customer/address' : 'Magento_Customer/js/address' ,
17
- 'Magento_Customer/change-email-password' : 'Magento_Customer/js/change-email-password'
17
+ 'Magento_Customer/change-email-password' : 'Magento_Customer/js/change-email-password' ,
18
+ globalSessionLoader : 'Magento_Customer/js/customer-global-session-loader.js'
18
19
}
19
20
}
20
21
} ;
Original file line number Diff line number Diff line change 19
19
"*": {
20
20
"Magento_Ui/js/block-loader": "<?= $ block ->escapeJs ($ block ->escapeUrl ($ block ->getViewFileUrl (
21
21
'images/loader-1.gif '
22
- ))) ?> "
22
+ ))) ?> ",
23
+ "Magento_Customer/js/customer-global-session-loader": {}
23
24
}
24
25
}
25
26
</script>
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright © Magento, Inc. All rights reserved.
3
+ * See COPYING.txt for license details.
4
+ */
5
+
6
+ define ( [
7
+ 'jquery' ,
8
+ 'Magento_Customer/js/customer-data'
9
+ ] , function ( $ , customerData ) {
10
+ 'use strict' ;
11
+
12
+ return function ( ) {
13
+ var customer = customerData . get ( 'customer' ) ;
14
+
15
+ // When the session is available, this customer menu will be available
16
+ if ( $ ( '.customer-menu' ) . length > 0 ) {
17
+ customerData . getInitCustomerData ( ) . done ( function ( ) {
18
+ // Check if the customer data is set in local storage, if not reload data from server
19
+ if ( ! customer ( ) . firstname ) {
20
+ customerData . reload ( [ ] , false ) ;
21
+ }
22
+ } ) ;
23
+ }
24
+ } ;
25
+ } ) ;
You can’t perform that action at this time.
0 commit comments