@@ -15,35 +15,36 @@ define([
15
15
'use strict' ;
16
16
17
17
var cacheKey = 'checkout-data' ,
18
- checkoutData ,
19
-
20
- /**
21
- * @return {* }
22
- */
23
- getData = function ( ) {
24
- return storage . get ( cacheKey ) ( ) ;
25
- } ,
26
18
27
19
/**
28
20
* @param {Object } data
29
21
*/
30
22
saveData = function ( data ) {
31
23
storage . set ( cacheKey , data ) ;
32
- } ;
24
+ } ,
33
25
34
- if ( $ . isEmptyObject ( getData ( ) ) ) {
35
- checkoutData = {
36
- 'selectedShippingAddress' : null , //Selected shipping address pulled from persistence storage
37
- 'shippingAddressFromData' : null , //Shipping address pulled from persistence storage
38
- 'newCustomerShippingAddress' : null , //Shipping address pulled from persistence storage for new customer
39
- 'selectedShippingRate' : null , //Shipping rate pulled from persistence storage
40
- 'selectedPaymentMethod' : null , //Payment method pulled from persistence storage
41
- 'selectedBillingAddress' : null , //Selected billing address pulled from persistence storage
42
- 'billingAddressFromData' : null , //Billing address pulled from persistence storage
43
- 'newCustomerBillingAddress' : null //Billing address pulled from persistence storage for new customer
26
+ /**
27
+ * @return {* }
28
+ */
29
+ getData = function ( ) {
30
+ var data = storage . get ( cacheKey ) ( ) ;
31
+
32
+ if ( $ . isEmptyObject ( data ) ) {
33
+ data = {
34
+ 'selectedShippingAddress' : null , //Selected shipping address pulled from persistence storage
35
+ 'shippingAddressFromData' : null , //Shipping address pulled from persistence storage
36
+ 'newCustomerShippingAddress' : null , //Shipping address pulled from persistence storage for customer
37
+ 'selectedShippingRate' : null , //Shipping rate pulled from persistence storage
38
+ 'selectedPaymentMethod' : null , //Payment method pulled from persistence storage
39
+ 'selectedBillingAddress' : null , //Selected billing address pulled from persistence storage
40
+ 'billingAddressFromData' : null , //Billing address pulled from persistence storage
41
+ 'newCustomerBillingAddress' : null //Billing address pulled from persistence storage for new customer
42
+ } ;
43
+ saveData ( data ) ;
44
+ }
45
+
46
+ return data ;
44
47
} ;
45
- saveData ( checkoutData ) ;
46
- }
47
48
48
49
return {
49
50
/**
0 commit comments