Skip to content

Commit

Permalink
Modify cookie.js
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlaki committed Aug 13, 2022
1 parent 096a07c commit 45a85ff
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions js/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ export function setCookie(key, value, expires = null, path = '/', options = {})
* Get the cookie with the given key.
*
* @param {string} key
* @param {mixed} value
* @return {mixed}
*/
export function getCookie(key, value = null) {
export function getCookie(key) {
const cookie = document.cookie.match(new RegExp(`(^| )${key}=([^;]+)`));

return (cookie && cookie[2]) ? cookie[2] : value;
return (cookie && cookie[2]) ? cookie[2] : null;
}

/**
Expand Down

0 comments on commit 45a85ff

Please sign in to comment.