File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import type { CookieOptions } from "#app" ;
2+ import type { H3Event } from "h3" ;
23
34type CookieOptionsWithoutReadonly < T > = CookieOptions < T > & {
45 readonly ?: false ;
@@ -15,29 +16,21 @@ class AppCookie<T extends string | null | undefined> {
1516 return useCookie ( this . name ) ;
1617 }
1718
19+ getServerSide ( event : H3Event ) {
20+ return getCookie ( event , this . name ) ;
21+ }
22+
1823 set ( value : T ) {
1924 useCookie ( this . name , this . options as CookieOptionsWithoutReadonly < T > | undefined ) . value = value ;
2025 }
2126
2227}
2328
24- class AppCookieHandler {
25-
26- private constructor ( ) { }
2729
28- private static readonly cookies = {
30+ export function useAppCookies ( ) {
31+ return {
2932
3033 sessionToken : new AppCookie < string | null > ( "dla_session_token" ) ,
31-
34+
3235 } as const ;
33-
34- static getCookies ( ) {
35- return AppCookieHandler . cookies ;
36- }
37-
38- }
39-
40-
41- export function useAppCookies ( ) {
42- return AppCookieHandler . getCookies ( ) ;
4336}
You can’t perform that action at this time.
0 commit comments