feat(web): 登录、注册功能

This commit is contained in:
R524809
2026-09-03 16:06:13 +08:00
parent 35fcf8776e
commit ffa86f8d55
15 changed files with 5026 additions and 5757 deletions
+8 -4
View File
@@ -1,11 +1,15 @@
import type { AuthSessionResponse, LoginRequest, RegisterRequest } from '@atlas/contracts';
import { api } from '@/services/api';
import type { AuthSession, LoginPayload, MeResult, RegisterPayload } from '@/types/auth';
import type { MeResult, RefreshResult } from '@/types/auth';
/** 账户与会话接口,契约见 docs/api/auth.md */
/** 账户与会话接口,契约见 docs/api/auth.md;类型来自 @atlas/contracts(me/refresh 暂为本地临时类型) */
export const authApi = {
register: (payload: RegisterPayload) => api.post<AuthSession>('/auth/register', payload),
register: (payload: RegisterRequest) =>
api.post<AuthSessionResponse>('/auth/register', payload),
login: (payload: LoginPayload) => api.post<AuthSession>('/auth/login', payload),
login: (payload: LoginRequest) => api.post<AuthSessionResponse>('/auth/login', payload),
refresh: () => api.post<RefreshResult>('/auth/refresh'),
logout: () => api.post<void>('/auth/logout'),