Files
certd/packages/ui/certd-client/src/views/framework/oauth/api.ts
T

56 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-11-27 01:59:22 +08:00
import { request } from "/src/api/service";
const apiPrefix = "/oauth";
export async function OauthLogin(type: string, forType?: string, from?: string, subtype?: string) {
2025-11-27 01:59:22 +08:00
return await request({
url: apiPrefix + `/login`,
method: "post",
data: {
type,
forType: forType || "login",
2025-11-30 01:13:55 +08:00
from: from || "web",
subtype,
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",
});
}