File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
- let isCookiesAccepted = getCookie ( "cookies-accepted" ) === "true" ;
2
-
3
1
// <> Cookies
2
+
3
+ // Returns whether the user has accepted the cookies or not, or undefined if the user hasn't chosen yet
4
+ function isCookiesAccepted ( ) {
5
+ const cookie = getCookie ( "cookies-accepted" ) ;
6
+ if ( ! cookie ) {
7
+ return undefined ;
8
+ }
9
+ return Boolean ( cookie ) ;
10
+ }
11
+
4
12
function setCookie ( cname , cvalue , exdays , force = false ) {
5
- if ( ! isCookiesAccepted && ! force )
13
+ if ( ! isCookiesAccepted ( ) && ! force )
6
14
return ;
7
15
8
16
const d = new Date ( ) ;
@@ -37,7 +45,7 @@ function getCookie(cname) {
37
45
* @param {double } exdays time in days
38
46
*/
39
47
function setStorageItem ( item , value , exdays , force = false ) {
40
- if ( ! isCookiesAccepted && ! force )
48
+ if ( ! isCookiesAccepted ( ) && ! force )
41
49
return ;
42
50
43
51
const d = new Date ( ) ;
You can’t perform that action at this time.
0 commit comments