Created
October 23, 2018 18:13
-
-
Save orangewolf/8b431691beec88cb2a1a348ab808bedf to your computer and use it in GitHub Desktop.
c is for cookies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/services/OptimizelyActions.js b/src/services/OptimizelyActions.js | |
| index bf38f78..a48e6aa 100644 | |
| --- a/src/services/OptimizelyActions.js | |
| +++ b/src/services/OptimizelyActions.js | |
| @@ -12,8 +12,14 @@ const DEFAULT_VARIATION = 'default' | |
| function getCookie(name) { | |
| const values = document.cookie.split(`; `) | |
| + const match = values.find(value => value.split('=')[0] === name) | |
| + if match { | |
| + const result = match.split('=')[1] | |
| + } else { | |
| + const result = null | |
| + } | |
| - return values.find(value => value.split('=')[0] === name).split('=')[1] | |
| + return result | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment