refac: api 시스템 교체
- procDecorator의 타입 복잡도를 낮춤 - 타입 에러가 살짝 더 깔끔함
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
import { type APINamespaceType, GET as GET } from "../defs";
|
||||
import { GET } from "../defs";
|
||||
import type { structure } from "../../apiStructure/sammoRootAPI";
|
||||
import type { DefAPINamespace, ExtractError, ExtractQuery, ExtractResponse } from "../../apiStructure/defs";
|
||||
import type { ExtractError, ExtractQuery, ExtractResponse } from "../../apiStructure/defs";
|
||||
import { StartSession } from "../ProcDecorator/StartSession";
|
||||
import { declProcDecorators } from "../ProcDecorator/base";
|
||||
|
||||
type BaseAPI = typeof structure.Login.ReqNonce;
|
||||
type RType = ExtractResponse<BaseAPI>;
|
||||
type EType = ExtractError<BaseAPI>;
|
||||
type QType = ExtractQuery<BaseAPI>;
|
||||
const argValidator = undefined;
|
||||
const procDecorator = [
|
||||
StartSession,
|
||||
] as const;
|
||||
|
||||
export const ReqNonce = GET<RType, EType, QType>(argValidator)(procDecorator)(
|
||||
async (query, ctx) => {
|
||||
export const ReqNonce = GET<RType, EType, QType>
|
||||
(undefined)
|
||||
(declProcDecorators([
|
||||
StartSession,
|
||||
] as const))
|
||||
(async (query, ctx) => {
|
||||
const nonce = await ctx.getValue<string>("nonce");
|
||||
if(nonce !== undefined){
|
||||
if (nonce !== undefined) {
|
||||
return {
|
||||
loginNonce: nonce,
|
||||
result: true,
|
||||
@@ -28,8 +29,4 @@ export const ReqNonce = GET<RType, EType, QType>(argValidator)(procDecorator)(
|
||||
loginNonce: newNonce,
|
||||
result: true,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
type BaseAPI2 = APINamespaceType<typeof structure.Login>['ReqNonce'];
|
||||
type A = typeof ReqNonce;
|
||||
});
|
||||
Reference in New Issue
Block a user