feat: 🏷️ add new utility types for session handling
This commit is contained in:
parent
c4cd04eb95
commit
0c14e63808
|
@ -1,3 +1,4 @@
|
||||||
|
import type { PageProps } from '$fresh/server.ts'
|
||||||
import { getCookies } from '@std/http/cookie'
|
import { getCookies } from '@std/http/cookie'
|
||||||
|
|
||||||
type SessionEntry<T extends unknown = unknown> = {
|
type SessionEntry<T extends unknown = unknown> = {
|
||||||
|
@ -6,6 +7,13 @@ type SessionEntry<T extends unknown = unknown> = {
|
||||||
value: T
|
value: T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SessionState {
|
||||||
|
session: Session
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SessionPageProps<T = unknown, S = Record<string, unknown>> =
|
||||||
|
PageProps<T, S & SessionState>
|
||||||
|
|
||||||
export class SessionStore {
|
export class SessionStore {
|
||||||
static #store = new Map<string, Session>()
|
static #store = new Map<string, Session>()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue