@riosst100/pwa-marketplace 3.3.3 → 3.3.4
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
|
@@ -70,62 +70,6 @@ const Adapter = props => {
|
|
|
70
70
|
const currentWebsiteCode = storage && storage.getItem('website_code') || process.env.WEBSITE_CODE;
|
|
71
71
|
|
|
72
72
|
useEffect(() => {
|
|
73
|
-
if (!websiteCodeInUrl) {
|
|
74
|
-
// history.replace(location.pathname + location.search)
|
|
75
|
-
} else if (websiteCodeInUrl && websiteCodeInUrl !== currentWebsiteCode) {
|
|
76
|
-
const storeCodeInUrl = websiteStores[websiteCodeInUrl];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// const search = location.search;
|
|
81
|
-
|
|
82
|
-
// const query = new URLSearchParams(search);
|
|
83
|
-
// const isAccessBaseWebsite = query.get('access_base_website') || (
|
|
84
|
-
// storage.getItem('access_base_website') || null
|
|
85
|
-
// );
|
|
86
|
-
|
|
87
|
-
// routerProps.basename = websiteCodeInUrl != process.env.WEBSITE_CODE && !isAccessBaseWebsite ? '/'+websiteCodeInUrl : '/';
|
|
88
|
-
|
|
89
|
-
// setNewRouterProps(routerProps);
|
|
90
|
-
|
|
91
|
-
// await removeCart();
|
|
92
|
-
|
|
93
|
-
// alert(storeCodeInUrl)
|
|
94
|
-
|
|
95
|
-
// update store/website saat url berubah, misal /id ke /sg
|
|
96
|
-
|
|
97
|
-
// issue store view code gk berubah, klo di graphql aman
|
|
98
|
-
|
|
99
|
-
// ini update di graphql dan di cookie, tapi di cookie beda klo ga di hardcode
|
|
100
|
-
|
|
101
|
-
// ini oke, store di graphql dari sini
|
|
102
|
-
// storeCodeInUrl = 'id_id_store_view';
|
|
103
|
-
// console.log('storeCodeInUrl',storeCodeInUrl)
|
|
104
|
-
|
|
105
|
-
// await apolloClient.clearCacheData(apolloClient, 'cart');
|
|
106
|
-
// await removeCart();
|
|
107
|
-
|
|
108
|
-
// klo enabled jd redirect tros
|
|
109
|
-
// storage.removeItem('cartId');
|
|
110
|
-
|
|
111
|
-
// storage.setItem('store_view_code', storeCodeInUrl);
|
|
112
|
-
// storage.setItem('website_code', websiteCodeInUrl);
|
|
113
|
-
// storage.setItem(
|
|
114
|
-
// 'store_view_currency',
|
|
115
|
-
// storeCurrencies[storeCodeInUrl]
|
|
116
|
-
// );
|
|
117
|
-
// storage.setItem(
|
|
118
|
-
// 'store_view_secure_base_media_url',
|
|
119
|
-
// storeSecureBaseMediaUrl[storeCodeInUrl]
|
|
120
|
-
// );
|
|
121
|
-
|
|
122
|
-
// We're required to reload the page as the basename doesn't
|
|
123
|
-
// change entirely without a full page reload.
|
|
124
|
-
// history.go(0);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// console.log('currentWebsiteCode',currentWebsiteCode)
|
|
128
|
-
|
|
129
73
|
if (!websiteCodeInUrl) {
|
|
130
74
|
const websiteCode = process.env.WEBSITE_CODE;
|
|
131
75
|
// if (websiteCode != storage.getItem('website_code')) {
|
|
@@ -168,7 +112,7 @@ const Adapter = props => {
|
|
|
168
112
|
}
|
|
169
113
|
// }
|
|
170
114
|
}
|
|
171
|
-
}, [websiteCodeInUrl
|
|
115
|
+
}, [websiteCodeInUrl]);
|
|
172
116
|
|
|
173
117
|
// TODO: Replace with app skeleton. See PWA-547.
|
|
174
118
|
if (!initialized) {
|
|
@@ -39,7 +39,18 @@ const StoreCodeRoute = () => {
|
|
|
39
39
|
// the storage value and refresh so that we start using the new code.
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
if (websiteCodeInUrl) {
|
|
42
|
-
|
|
42
|
+
const websiteCodes = [];
|
|
43
|
+
|
|
44
|
+
AVAILABLE_WEBSITES.forEach(store => {
|
|
45
|
+
websiteCodes.push(store.website_code);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const { location } = globalThis;
|
|
49
|
+
const match = location && location.pathname.split("/")[1];
|
|
50
|
+
const websiteCodeInUrl = websiteCodes.find((str) => str === match);
|
|
51
|
+
|
|
52
|
+
const prefix = websiteCodeInUrl ? websiteCodeInUrl + '_' : '';
|
|
53
|
+
|
|
43
54
|
let storeCodeInUrl = websiteStores[websiteCodeInUrl];
|
|
44
55
|
|
|
45
56
|
storage.setItem(prefix + 'store_view_code', storeCodeInUrl);
|