1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/components/lib/cookies.ts
2023-06-14 18:20:59 +00:00

15 lines
367 B
TypeScript

import Cookies from 'js-cookie'
// This library only works client side,
// so on the server side we return a mock.
export default typeof document === 'undefined'
? {
get: () => undefined,
set: () => undefined,
}
: Cookies.withAttributes({
expires: 365,
sameSite: 'strict',
secure: document.location.protocol !== 'http:',
})