2025-11-27 01:59:22 +08:00
|
|
|
import { request } from "/src/api/service";
|
|
|
|
|
|
|
|
|
|
const apiPrefix = "/oauth";
|
|
|
|
|
|
2025-11-30 01:13:55 +08:00
|
|
|
export async function OauthLogin(type: string, forType?: string, from?: string) {
|
2025-11-27 01:59:22 +08:00
|
|
|
return await request({
|
|
|
|
|
url: apiPrefix + `/login`,
|
|
|
|
|
method: "post",
|
|
|
|
|
data: {
|
|
|
|
|
type,
|
2025-11-29 03:25:21 +08:00
|
|
|
forType: forType || "login",
|
2025-11-30 01:13:55 +08:00
|
|
|
from: from || "web",
|
2025-11-27 01:59:22 +08:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-28 01:42:42 +08:00
|
|
|
export async function OauthToken(type: string, validationCode: string) {
|
2025-11-27 01:59:22 +08:00
|
|
|
return await request({
|
2025-11-28 01:42:42 +08:00
|
|
|
url: apiPrefix + `/token`,
|
2025-11-27 01:59:22 +08:00
|
|
|
method: "post",
|
|
|
|
|
data: {
|
|
|
|
|
type,
|
2025-11-28 01:42:42 +08:00
|
|
|
validationCode,
|
2025-11-27 01:59:22 +08:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function AutoRegister(type: string, code: string) {
|
|
|
|
|
return await request({
|
|
|
|
|
url: apiPrefix + `/autoRegister`,
|
|
|
|
|
method: "post",
|
|
|
|
|
data: {
|
|
|
|
|
validationCode: code,
|
|
|
|
|
type,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function BindUser(code: string) {
|
|
|
|
|
return await request({
|
|
|
|
|
url: apiPrefix + `/bind`,
|
|
|
|
|
method: "post",
|
|
|
|
|
data: {
|
|
|
|
|
validationCode: code,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-11-28 01:42:42 +08:00
|
|
|
|
|
|
|
|
export async function GetOauthProviders() {
|
|
|
|
|
return await request({
|
|
|
|
|
url: apiPrefix + "/providers",
|
|
|
|
|
method: "post",
|
|
|
|
|
});
|
|
|
|
|
}
|