mirror of
https://github.com/vercel/commerce.git
synced 2025-07-14 08:21:22 +00:00
* Update README.md * Initial Commit * Commited Keys * GraphQL Changes * GraphQL Query * Final Changes * Changed login.ts * Made changes in login.ts * Final Changes * Refactored login.ts * SignUp Initial Checkin * logout Initial * Customer Account Initial Commit * Logout - deleted cookie * Reverted ReadMe and UserNav file * Final Changes * Resolved comments * Resolved comments 1 * Resolved comments 2 * Resolved comments 3 * Resolved comments 4 Co-authored-by: SushantJadhav <Sushant.Jadhav@kibocommerce.com>
13 lines
368 B
TypeScript
13 lines
368 B
TypeScript
export function prepareSetCookie(name: string, value: string, options: any = {}): string {
|
|
const cookieValue = [`${name}=${value}`];
|
|
|
|
if (options.maxAge) {
|
|
cookieValue.push(`Max-Age=${options.maxAge}`);
|
|
}
|
|
|
|
if (options.expires && !options.maxAge) {
|
|
cookieValue.push(`Expires=${options.expires.toUTCString()}`);
|
|
}
|
|
|
|
return cookieValue.join('; ');
|
|
} |