feat: 实现前端卡密管理界面
- 卡密列表展示与分页功能 - 单个/批量创建卡密 - 卡密删除与批量删除 - 卡密导出功能 (file-saver) - 启用/禁用状态切换 - 状态判断 (有效/已使用/已失效) - Toast 通知系统 (vue-sonner) - 登录页面错误提示优化 - 后端登录错误消息中文化
This commit is contained in:
29
frontend/src/api/auth.ts
Normal file
29
frontend/src/api/auth.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import request from './request'
|
||||
|
||||
export interface LoginRequest {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
success: boolean
|
||||
token?: string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export interface ProfileResponse {
|
||||
success: boolean
|
||||
user?: {
|
||||
id: number
|
||||
username: string
|
||||
}
|
||||
message?: string
|
||||
}
|
||||
|
||||
export function login(data: LoginRequest) {
|
||||
return request.post<LoginResponse>('/api/login', data)
|
||||
}
|
||||
|
||||
export function getProfile() {
|
||||
return request.get<ProfileResponse>('/api/profile')
|
||||
}
|
||||
Reference in New Issue
Block a user