Skip to content

Commit 81a848f

Browse files
committed
some more cleanup
1 parent ce051b7 commit 81a848f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/CookiePreferences/CookiePreferencesCheck.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import { useState } from 'react'
55

66
const CookiePreferencesCheck = ({ cookieConsentValue, disableCookies, enableCookies }) => {
77
// NOTE: the enable/disable cookies functions change the actual value.
8-
// the variable below is so the radio buttons update after being clicked.
9-
const [allowed, setAllowed] = useState(cookieConsentValue)
8+
// the state variable below is so the radio buttons update after being clicked.
9+
// NOTE: cookie values are strings. we are parsing it in state so we don't have to
10+
// do strict evaluations (===) with strings in the code below.
11+
const [allowed, setAllowed] = useState(JSON.parse(cookieConsentValue))
1012

1113
const handleEnablingCookies = () => {
1214
enableCookies()
@@ -43,7 +45,7 @@ const CookiePreferencesCheck = ({ cookieConsentValue, disableCookies, enableCook
4345
}
4446

4547
CookiePreferencesCheck.propTypes = {
46-
cookieConsentValue: PropTypes.bool.isRequired,
48+
cookieConsentValue: PropTypes.string.isRequired,
4749
disableCookies: PropTypes.func.isRequired,
4850
enableCookies: PropTypes.func.isRequired,
4951
}

src/components/CookiePreferences/CookiePreferencesModal.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { useState } from 'react'
88
const CookiePreferencesModal = ({ getCookieConsent, disableCookies, enableCookies }) => {
99
const [show, setShow] = useState(getCookieConsent)
1010
const handleClose = () => setShow(false)
11-
const handleShow = () => setShow(true)
1211

1312
const handleEnablingCookies = () => {
1413
enableCookies()

0 commit comments

Comments
 (0)