Skip to content

Commit

Permalink
Feat: Add new helper 'getCookie.js' for cookie data retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
ITurres committed Mar 24, 2024
1 parent 9648fdc commit a4b958e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/helpers/getCookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const getCookie = (cookieName) => {
if (document.cookie.includes(`${cookieName}`)) {
const cookieData = document.cookie
.split('; ')
.find((cookie) => cookie.startsWith(`${cookieName}=`));

if (cookieData) {
return cookieData;
}
}

return null;
};

export default getCookie;

0 comments on commit a4b958e

Please sign in to comment.