Files
18xchat/assets/Scripts/chat18x/network/services/HttpAuthService.ts
T

32 lines
1.0 KiB
TypeScript
Raw Normal View History

2025-08-29 16:39:41 +08:00
import { ApiClient } from "../client/ApiClient";
import type { Endpoint } from "../client/endpoints";
import type { ApiResponse } from "../client/types";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import type { IAuthService } from "./IAuthService";
export class HttpAuthService implements IAuthService {
constructor(private api = ApiClient.I) {}
// 登录
async login(req: proto.cs.ICSLoginReq): Promise<ApiResponse<proto.cs.ICSLoginRes>> {
const ep: Endpoint<proto.cs.ICSLoginReq, proto.cs.ICSLoginRes> = {
path: "api/acc/login",
method: "POST",
codec: "json",
needsAuth: false,
};
return this.api.call(ep, req);
}
2025-10-16 11:19:07 +08:00
/** 上报事件 */
async pointEvent(req: proto.cs.ICSPointEventReq): Promise<ApiResponse<proto.cs.ICSPointEventRes>> {
const ep: Endpoint<proto.cs.ICSPointEventReq, proto.cs.ICSPointEventRes> = {
path: "api/logic/pointEvent",
method: "POST",
codec: "json",
needsAuth: false,
};
return this.api.call(ep, req);
}
2025-08-29 16:39:41 +08:00
}