@foal/core
Version:
Full-featured Node.js framework, with no complexity
20 lines (19 loc) • 715 B
TypeScript
import { Class, Context, HookDecorator, ServiceManager } from '../../core';
import { SessionStore } from '../core';
export type UseSessionOptions = {
store?: Class<SessionStore>;
cookie?: boolean;
csrf?: boolean;
redirectTo?: string;
openapi?: boolean;
required?: boolean;
create?: boolean;
userCookie?: (ctx: Context, services: ServiceManager) => string | Promise<string>;
} & ({
userIdType: 'string';
user?: (id: string, services: ServiceManager) => Promise<Context['user']>;
} | {
userIdType?: 'number';
user?: (id: number, services: ServiceManager) => Promise<Context['user']>;
});
export declare function UseSessions(options?: UseSessionOptions): HookDecorator;