refactor(api): remove unused network endpoints
This commit is contained in:
@@ -10,7 +10,6 @@ import { httpClient } from "./http_client";
|
||||
import { ApiPath } from "./api_path";
|
||||
import { ApiEnvelope, unwrap } from "./response_helper";
|
||||
import {
|
||||
AppleLoginRequest,
|
||||
FacebookLoginRequest,
|
||||
FbIdLoginRequest,
|
||||
GoogleLoginRequest,
|
||||
@@ -21,7 +20,6 @@ import {
|
||||
RefreshTokenRequest,
|
||||
RefreshTokenResponse,
|
||||
RegisterRequest,
|
||||
SendCodeRequest,
|
||||
} from "@/data/dto/auth";
|
||||
import { User } from "@/data/dto/user";
|
||||
import type { UserData } from "@/data/schemas/user/user";
|
||||
@@ -30,16 +28,6 @@ import { Logger } from "@/utils";
|
||||
const log = new Logger("DataServicesApiAuthApi");
|
||||
|
||||
export class AuthApi {
|
||||
/**
|
||||
* 发送验证码
|
||||
*/
|
||||
async sendCode(body: SendCodeRequest): Promise<void> {
|
||||
await httpClient<ApiEnvelope<unknown>>(ApiPath.sendCode, {
|
||||
method: "POST",
|
||||
body: body.toJson(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱密码登录
|
||||
*/
|
||||
@@ -61,17 +49,6 @@ export class AuthApi {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Apple 登录
|
||||
*/
|
||||
async appleLogin(body: AppleLoginRequest): Promise<LoginResponse> {
|
||||
const env = await httpClient<ApiEnvelope<unknown>>(ApiPath.appleLogin, {
|
||||
method: "POST",
|
||||
body: body.toJson(),
|
||||
});
|
||||
return LoginResponse.fromJson(unwrap(env) as Record<string, unknown>);
|
||||
}
|
||||
|
||||
/**
|
||||
* Google 登录
|
||||
*/
|
||||
@@ -112,7 +89,7 @@ export class AuthApi {
|
||||
* 不要再用 `unwrap` + `LogoutResponse.fromJson` 解析 —— Zod schema 是 z.object,
|
||||
* 对 null 会抛 ZodError "Invalid input: expected object, received null"。
|
||||
*
|
||||
* 对齐 `register` / `sendCode` 的写法:调通就完事,不解析响应体。
|
||||
* 对齐 `register` 的写法:调通就完事,不解析响应体。
|
||||
*/
|
||||
async logout(): Promise<void> {
|
||||
await httpClient<ApiEnvelope<unknown>>(ApiPath.logout, {
|
||||
|
||||
Reference in New Issue
Block a user