feat: 🏷️ add new utility types for session handling

This commit is contained in:
Julien Oculi 2024-06-13 23:51:30 +02:00
parent c4cd04eb95
commit 0c14e63808

View file

@ -1,3 +1,4 @@
import type { PageProps } from '$fresh/server.ts'
import { getCookies } from '@std/http/cookie'
type SessionEntry<T extends unknown = unknown> = {
@ -6,6 +7,13 @@ type SessionEntry<T extends unknown = unknown> = {
value: T
}
export interface SessionState {
session: Session
}
export type SessionPageProps<T = unknown, S = Record<string, unknown>> =
PageProps<T, S & SessionState>
export class SessionStore {
static #store = new Map<string, Session>()