/** * Sets a cookie with persistent maxAge for mobile worker sessions. * For desktop sessions, sets a normal session cookie (no maxAge). * * Mobile sessions are identified by the `logship_mw` cookie being set to '1'. * This ensures mobile PWA users stay logged in even when the app is backgrounded * and the browser kills the process (which clears session cookies). */ const MOBILE_MAX_AGE = 30 * 24 * 60 * 60 // 30 days in seconds export default function setAuthCookie(event: any, name: string, value: any) { const isMobileWorker = getCookie(event, 'logship_mw') if (isMobileWorker === '1') { setCookie(event, name, value, { maxAge: MOBILE_MAX_AGE }) } else { setCookie(event, name, value) } }