website/src/lib/index.ts

15 lines
528 B
TypeScript
Raw Normal View History

2024-10-01 02:44:39 +03:00
import type { Cookies } from '@sveltejs/kit'
export const scopeCookies = (cookies: Cookies, path: string) => {
return {
get: (key: string) => {
return cookies.get(key)
},
set: (key: string, value: string, props: import('cookie').CookieSerializeOptions = {}) => {
cookies.set(key, value, { ...props, path })
},
delete: (key: string, props: import('cookie').CookieSerializeOptions = {}) => {
cookies.delete(key, { ...props, path })
}
}
}