From b248e4749f9d456ee2daff34fb55bc6b9c7dc63d Mon Sep 17 00:00:00 2001 From: Justin Hynes Date: Mon, 4 Mar 2024 14:18:48 +0000 Subject: [PATCH] refactor: remove unused `cookies.js` util file When assessing the code coverage for the project, I noticed that the `setCookie` and `getCookie` utility functions had zero coverage. When trying to determine where this functionality is used, I couldn't find it being used or imported anywhere in the project. After a bit of looking around, it looks like the it was missed in some recent cleanup. See https://github.com/openedx/frontend-app-learner-dashboard/pull/112 which removed the use of `setCookie` and `getCookie` but didn't remove these utility functions. --- src/utils/cookies.js | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 src/utils/cookies.js diff --git a/src/utils/cookies.js b/src/utils/cookies.js deleted file mode 100644 index 6246cb8e..00000000 --- a/src/utils/cookies.js +++ /dev/null @@ -1,16 +0,0 @@ -import Cookies from 'universal-cookie'; -import { configuration } from '../config'; - -export function setCookie(cookieName, cookieValue, cookieExpiry) { - const cookies = new Cookies(); - const options = { domain: configuration.SESSION_COOKIE_DOMAIN, path: '/' }; - if (cookieExpiry) { - options.expires = new Date(Date.now() + cookieExpiry * 864e5); - } - cookies.set(cookieName, cookieValue, options); -} - -export function getCookie(cookieName) { - const cookies = new Cookies(); - return cookies.get(cookieName); -}