npm-pkg-hook 1.3.0 → 1.3.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
package/src/hooks/index.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import Cookies from 'js-cookie';
|
|
3
|
+
|
|
4
|
+
export const useGetStoreCookie = () => {
|
|
5
|
+
const [vpStoreCookie, setVpStoreCookie] = useState(null);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const getCookieValue = () => {
|
|
9
|
+
const cookieValue = Cookies.get('vp.store');
|
|
10
|
+
console.log('Cookie Value:', cookieValue);
|
|
11
|
+
|
|
12
|
+
if (cookieValue) {
|
|
13
|
+
setVpStoreCookie(cookieValue);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
getCookieValue();
|
|
18
|
+
}, []); // Empty dependency array, so this effect runs once
|
|
19
|
+
|
|
20
|
+
return vpStoreCookie;
|
|
21
|
+
};
|
|
22
|
+
|
package/src/utils/index.js
CHANGED
|
@@ -37,7 +37,7 @@ export const validationSubmitHooks = elements => {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const getCurrentDomain = () => {
|
|
40
|
-
return typeof window !== 'undefined' && window.location.hostname
|
|
40
|
+
return typeof window !== 'undefined' && window.location.hostname;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export function RandomCode (length) {
|
|
@@ -50,6 +50,7 @@ export function RandomCode (length) {
|
|
|
50
50
|
}
|
|
51
51
|
return result
|
|
52
52
|
}
|
|
53
|
+
|
|
53
54
|
/**
|
|
54
55
|
* actualizar cache de apollo
|
|
55
56
|
* @param {{ cache: object, query: object, nameFun: string, dataNew: object, type: number, id: string }} params Parámetros para actualizar el cachet de apollo
|