@riosst100/pwa-marketplace 3.2.1 → 3.2.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
|
@@ -14,12 +14,21 @@ const WebsiteSwitcherItem = props => {
|
|
|
14
14
|
const href = location.href;
|
|
15
15
|
|
|
16
16
|
let match = location && location.pathname.split("/")[1];
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
const websiteCode = option2 != "base" ? option2 : '';
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
let url = href + websiteCode;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if (match && option2 == "base") {
|
|
20
24
|
match = match + "/";
|
|
25
|
+
|
|
26
|
+
url = href.replace(match, websiteCode);
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
|
|
29
|
+
console.log('href',href)
|
|
30
|
+
console.log('match',match)
|
|
31
|
+
console.log('url',url)
|
|
23
32
|
|
|
24
33
|
// const handleClick = useCallback(() => {
|
|
25
34
|
// onClick(option, option2);
|
|
@@ -73,10 +73,10 @@ const Adapter = props => {
|
|
|
73
73
|
const match = location && location.pathname.split("/")[1];
|
|
74
74
|
let websiteCodeInUrl = websiteCodes.find((str) => str === match);
|
|
75
75
|
|
|
76
|
-
const { getWebsiteByUserIp } = useWebsiteByIp(websiteCodeInUrl);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
// const { getWebsiteByUserIp } = useWebsiteByIp(websiteCodeInUrl);
|
|
77
|
+
const getWebsiteByUserIp = {
|
|
78
|
+
countryCode: 'SG'
|
|
79
|
+
}
|
|
80
80
|
|
|
81
81
|
useEffect(() => {
|
|
82
82
|
if (websiteCodeInUrl) {
|
|
@@ -157,7 +157,8 @@ const Adapter = props => {
|
|
|
157
157
|
storage.getItem('access_base_website') || null
|
|
158
158
|
);
|
|
159
159
|
|
|
160
|
-
const websiteCode = getWebsiteByUserIp.countryCode && !isAccessBaseWebsite ? getWebsiteByUserIp.countryCode.toLowerCase() : process.env.WEBSITE_CODE;
|
|
160
|
+
// const websiteCode = getWebsiteByUserIp.countryCode && !isAccessBaseWebsite ? getWebsiteByUserIp.countryCode.toLowerCase() : process.env.WEBSITE_CODE;
|
|
161
|
+
const websiteCode = process.env.WEBSITE_CODE;
|
|
161
162
|
|
|
162
163
|
if (websiteCodes.find((str) => str === websiteCode)) {
|
|
163
164
|
routerProps.basename = websiteCode != process.env.WEBSITE_CODE && !isAccessBaseWebsite ? '/'+websiteCode : '/';
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { useState, useMemo, useEffect } from 'react';
|
|
2
|
-
import axios from 'axios';
|
|
1
|
+
// import { useState, useMemo, useEffect } from 'react';
|
|
2
|
+
// import axios from 'axios';
|
|
3
3
|
|
|
4
4
|
export const useWebsiteByIp = websiteCodeInUrl => {
|
|
5
|
-
const [websiteByUserIpData, setWebsiteByUserIpData] = useState(null);
|
|
5
|
+
// const [websiteByUserIpData, setWebsiteByUserIpData] = useState(null);
|
|
6
6
|
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
// useEffect(() => {
|
|
8
|
+
// if (!websiteCodeInUrl) {
|
|
9
|
+
// const fetchData = async () => {
|
|
10
|
+
// axios.get('https://extreme-ip-lookup.com/json/?key=NqwiAPsYZXoA3jwsnP7B').then((response) => {
|
|
11
|
+
// let data = response.data;
|
|
12
|
+
// if (data) {
|
|
13
|
+
// setWebsiteByUserIpData(data)
|
|
14
|
+
// }
|
|
15
|
+
// }).catch((error) => {
|
|
16
|
+
// });
|
|
17
|
+
// };
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, [websiteCodeInUrl]);
|
|
19
|
+
// fetchData();
|
|
20
|
+
// }
|
|
21
|
+
// }, [websiteCodeInUrl]);
|
|
22
22
|
|
|
23
|
-
const getWebsiteByUserIp = useMemo(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [websiteByUserIpData]);
|
|
23
|
+
// const getWebsiteByUserIp = useMemo(() => {
|
|
24
|
+
// if (websiteByUserIpData) {
|
|
25
|
+
// return websiteByUserIpData;
|
|
26
|
+
// } else {
|
|
27
|
+
// return null;
|
|
28
|
+
// }
|
|
29
|
+
// }, [websiteByUserIpData]);
|
|
30
|
+
const getWebsiteByUserIp = null;
|
|
30
31
|
|
|
31
32
|
return {
|
|
32
33
|
getWebsiteByUserIp
|