diff --git a/src/api/problem.ts b/src/api/problem.ts index 4ff23a7..7ad7711 100644 --- a/src/api/problem.ts +++ b/src/api/problem.ts @@ -50,23 +50,26 @@ export interface UploadResp { } export class ProblemApi { - async CreateVersion(data: CreateVersionReq, token: string): Promise { + static async CreateVersion( + data: CreateVersionReq, + token: string, + ): Promise { return send("/problem/create_version", data, token); } - async Details(data: DetailsReq): Promise { + static async Details(data: DetailsReq): Promise { return send("/problem/details", data); } - async Search(data: SearchReq): Promise { + static async Search(data: SearchReq): Promise { return send("/problem/search", data); } - async Update(data: UpdateReq, token: string): Promise { + static async Update(data: UpdateReq, token: string): Promise { return send("/problem/update", data, token); } - async Upload(token: string): Promise { + static async Upload(token: string): Promise { return send("/problem/upload", null, token); } } diff --git a/src/api/status.ts b/src/api/status.ts index 358c863..2b6e2f6 100644 --- a/src/api/status.ts +++ b/src/api/status.ts @@ -48,11 +48,11 @@ export interface QueryResp { } export class StatusApi { - async Query(data: QueryReq): Promise { + static async Query(data: QueryReq): Promise { return send("/status/query", data); } - async QueryByVersion( + static async QueryByVersion( data: QueryByVersionReq, token: string, ): Promise { diff --git a/src/api/submission.ts b/src/api/submission.ts index 7197465..56d0a58 100644 --- a/src/api/submission.ts +++ b/src/api/submission.ts @@ -32,18 +32,18 @@ export interface ReJudgeReq { } export class SubmissionApi { - async Create(data: SubmitReq, token: string): Promise { + static async Create(data: SubmitReq, token: string): Promise { return send("/submission/create", data, token); } - async Query(data: QueryReq, token: string): Promise { + static async Query(data: QueryReq, token: string): Promise { if (!data.pid && !data.uid) { throw new Error("Missing required fields"); } return send("/submission/query", data, token); } - async ReJudge(data: ReJudgeReq, token: string): Promise { + static async ReJudge(data: ReJudgeReq, token: string): Promise { return send("/submission/rejudge", data, token); } } diff --git a/src/api/user.ts b/src/api/user.ts index d384668..b504ae3 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -16,25 +16,25 @@ export interface UserProfile { } export class UserApi { - async Create(data: UserReq): Promise { + static async Create(data: UserReq): Promise { if (!data.username || !data.password || !data.nickname) { throw new Error("Missing required fields"); } return send("/user/create", data); } - async Login(data: UserReq): Promise { + static async Login(data: UserReq): Promise { if (!data.username || !data.password) { throw new Error("Missing required fields"); } return send("/user/login", data); } - async Logout(token: string): Promise { + static async Logout(token: string): Promise { return send("/user/logout", null, token); } - async Profile(data: UserReq, token: string): Promise { + static async Profile(data: UserReq, token: string): Promise { return send("/user/profile", data, token); } }