feat(阶段1): 搬入 ojnext 为 apps/web,未改业务代码
This commit is contained in:
34
apps/web/src/shared/api.ts
Normal file
34
apps/web/src/shared/api.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import http from "utils/http"
|
||||
import type { Profile, Tag } from "utils/types"
|
||||
|
||||
export function login(data: { username: string; password: string }) {
|
||||
return http.post("login", data)
|
||||
}
|
||||
|
||||
export function signup(data: {
|
||||
username: string
|
||||
email: string
|
||||
password: string
|
||||
}) {
|
||||
return http.post("register", data)
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return http.get("logout")
|
||||
}
|
||||
|
||||
export function getProfile(username: string = "") {
|
||||
return http.get<Profile>("profile", { params: { username } })
|
||||
}
|
||||
|
||||
export function getProblemTagList() {
|
||||
return http.get<Tag[]>("problem/tags")
|
||||
}
|
||||
|
||||
export function getHitokoto() {
|
||||
return http.get("hitokoto")
|
||||
}
|
||||
|
||||
export function getClassUsernames(classroom: string) {
|
||||
return http.get("class_usernames", { params: { classroom: classroom } })
|
||||
}
|
||||
Reference in New Issue
Block a user