api 구조 변경

This commit is contained in:
2023-08-18 13:11:59 +00:00
parent bfe0b99d44
commit de0b851217
8 changed files with 70 additions and 53 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import type { LoginCtx } from "./ReqLogin.js";
import type { SessionCtx } from "./StartSession.js";
import type { DecoratorResult, ProcDecoratorGenerator } from "./base.js";
import type { ProcDecoratorGenerator } from "./base.js";
export type GameLoginCtx = {
generalID: number;
+2 -1
View File
@@ -8,10 +8,11 @@ export type LoginCtx = {
allowServerAction: Record<string, number>;
loginDate: Date;
}
export const loginCtxSessionKey = 'loginCtx';
export function ReqLogin<Q extends SessionCtx>(): ProcDecorator<LoginCtx & Q, Q> {
return (ctx) => {
const loginCtx = ctx.session.getItem<LoginCtx>('loginCtx');
const loginCtx = ctx.session.getItem<LoginCtx>(loginCtxSessionKey);
if(!loginCtx){
return [{
result: false,