function setCookie(name, value, houres) { // eslint-disable-next-line Date.prototype.addHours = function (h) { this.setTime(this.getTime() + h * 60 * 60 * 1000); return this; }; let expires = ''; if (houres) { const oneHourFromNow = new Date().addHours(1); expires = '; expires=' + oneHourFromNow.toUTCString(); } document.cookie = name + '=' + (value || '') + expires + '; path=/'; } function getCookie(name) { let nameEQ = name + '='; let ca = document.cookie.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) === ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length); } return null; } function eraseCookie(name) { document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; } export { getCookie, setCookie, eraseCookie }; // ./src/utils/