Skip to content

Commit

Permalink
Set expiry of 'international' cookie for 1 year for selection of regi…
Browse files Browse the repository at this point in the history
…on from region selector (adobecom#2848)
  • Loading branch information
Deva309 authored Sep 9, 2024
1 parent 347dbca commit 2cc3d12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/blocks/region-nav/region-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { getConfig } from '../../utils/utils.js';
/* c8 ignore next 11 */
function handleEvent(prefix, link) {
const domain = window.location.host.endsWith('.adobe.com') ? 'domain=adobe.com' : '';
document.cookie = `international=${prefix};path=/;${domain}`;
const maxAge = 365 * 24 * 60 * 60; // max-age in seconds for 365 days
document.cookie = `international=${prefix};max-age=${maxAge};path=/;${domain}`;
sessionStorage.setItem('international', prefix);
fetch(link.href, { method: 'HEAD' }).then((resp) => {
if (!resp.ok) throw new Error('request failed');
Expand Down

0 comments on commit 2cc3d12

Please sign in to comment.