@nuskin/ns-shop 7.0.11-cx24-7213.1 → 7.0.11-cx24-7213.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-shop",
3
- "version": "7.0.11-cx24-7213.1",
3
+ "version": "7.0.11-cx24-7213.2",
4
4
  "description": "The description that will amaze and astound your audience when they read it",
5
5
  "main": "src/shop.js",
6
6
  "scripts": {
@@ -48,7 +48,7 @@ function _getEquinoxSession() {
48
48
  endpoint: 'customers'
49
49
  }
50
50
 
51
- console.log("sample log");
51
+ console.log("Equinox session");
52
52
 
53
53
  // const customerSession = sessionStorage.getItem('customerSession') ? JSON.parse(sessionStorage.getItem('customerSession')) : ''
54
54
  // if (customerSession === '') {
@@ -58,7 +58,19 @@ function _getEquinoxSession() {
58
58
  // return null
59
59
  // }
60
60
 
61
- return _equinoxRequest(equinoxRequestOptions);
61
+ let customerSession = sessionStorage.getItem('customerSession');
62
+ if (!customerSession) {
63
+ console.log("No session found, creating a new one");
64
+ return _equinoxRequest(equinoxRequestOptions).then(response => {
65
+ sessionStorage.setItem('customerSession', JSON.stringify(response.data));
66
+ return response;
67
+ });
68
+ } else {
69
+ console.log("Session found");
70
+ return Promise.resolve(JSON.parse(customerSession));
71
+ }
72
+
73
+ // return _equinoxRequest(equinoxRequestOptions);
62
74
 
63
75
  }
64
76