File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
app/code/Magento/Persistent/view/frontend/web/js/view Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,7 @@ define([
15
15
* Init.
16
16
*/
17
17
init : function ( ) {
18
- customerData . reload ( [ 'persistent' , 'cart' ] , true ) ;
19
-
20
- let persistent = customerData . get ( 'persistent' ) ;
18
+ var persistent = customerData . get ( 'persistent' ) ;
21
19
22
20
if ( persistent ( ) . fullname === undefined ) {
23
21
customerData . get ( 'persistent' ) . subscribe ( this . replacePersistentWelcome ) ;
@@ -30,7 +28,7 @@ define([
30
28
* Replace welcome message for customer with persistent cookie.
31
29
*/
32
30
replacePersistentWelcome : function ( ) {
33
- let persistent = customerData . get ( 'persistent' ) ,
31
+ var persistent = customerData . get ( 'persistent' ) ,
34
32
welcomeElems ;
35
33
36
34
if ( persistent ( ) . fullname !== undefined ) {
Original file line number Diff line number Diff line change @@ -39,6 +39,29 @@ define([
39
39
}
40
40
41
41
return expiredSections ;
42
+ } ,
43
+
44
+ /**
45
+ * @param {Object } settings
46
+ * @constructor
47
+ */
48
+ 'Magento_Customer/js/customer-data' : function ( originFn , invalidateOptions ) {
49
+ let date ;
50
+ let storage = $ . initNamespaceStorage ( 'mage-cache-storage' ) . localStorage ;
51
+ if ( new Date ( $ . localStorage . get ( 'mage-cache-timeout' ) ) < new Date ( ) ) {
52
+ storage . removeAll ( ) ;
53
+ this . reload ( [ 'persistent' , 'cart' ] , true ) ;
54
+ }
55
+ date = new Date ( Date . now ( ) + parseInt ( invalidateOptions . cookieLifeTime , 10 ) * 1000 ) ;
56
+ $ . localStorage . set ( 'mage-cache-timeout' , date ) ;
57
+
58
+ if ( ! $ . cookieStorage . isSet ( 'mage-cache-sessid' ) ) {
59
+ $ . cookieStorage . set ( 'mage-cache-sessid' , true ) ;
60
+ storage . removeAll ( ) ;
61
+ this . reload ( [ 'persistent' , 'cart' ] , true ) ;
62
+ }
63
+ originFn ( ) ;
64
+
42
65
}
43
66
} ;
44
67
You can’t perform that action at this time.
0 commit comments