feat: 大部分注册登录功能

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-24 18:02:42 +08:00
parent 5ab74ad9dd
commit 5294528148
23 changed files with 858 additions and 167 deletions
+8 -7
View File
@@ -1,20 +1,21 @@
// server/api/auth/logout.get.ts
import type { UserLogoutResult } from "#shared/types";
import type { IUserLogoutData } from "#shared/types";
import {
createSuccessResponse,
createUpstreamErrorResponse,
newApiFetch
} from "~~/server/utils";
/**
* GET /api/auth/logout
*
* 登出流程:
* 1. 服务端直接转发 GET 请求到上游 NewAPI
* 2. 上游成功后统一返回 { code: 0, data: null, msg: "登出成功" }
*/
export default defineEventHandler(async () => {
try {
await newApiFetch<UserLogoutResult>("/api/user/logout", {
await newApiFetch<IUserLogoutData>("/api/user/logout", {
method: "GET"
});
return createSuccessResponse(null, "登出成功");
return createSuccessResponse<IUserLogoutData>(null, "登出成功");
} catch (error) {
return createUpstreamErrorResponse(error, "登出失败");
}