新增 vue-app(生成/收藏/历史/登录/优化/Android/饭菜/诗词/简历等),Flask 增加 user_context 并调整历史、生成、简历等路由;模板 base/generate 可访问性改进;补充部署说明与文档。 Made-with: Cursor
29 lines
844 B
TypeScript
29 lines
844 B
TypeScript
import client from '../client'
|
|
import type { LoginResponse, LogoutResponse, RegisterResponse } from '../types/auth'
|
|
import type { CheckLoginResponse } from '../types/user'
|
|
|
|
export function checkLogin() {
|
|
return client.get<CheckLoginResponse>('/api/check-login').then((r) => r.data)
|
|
}
|
|
|
|
export function postLogin(login_name: string, login_pwd: string) {
|
|
return client.post<LoginResponse>('/api/login', { login_name, login_pwd }).then((r) => r.data)
|
|
}
|
|
|
|
export function postLogout() {
|
|
return client.post<LogoutResponse>('/api/logout', {}).then((r) => r.data)
|
|
}
|
|
|
|
export interface RegisterBody {
|
|
login_name: string
|
|
login_pwd: string
|
|
nickname: string
|
|
email?: string
|
|
mobile?: string
|
|
sex?: number
|
|
}
|
|
|
|
export function postRegister(body: RegisterBody) {
|
|
return client.post<RegisterResponse>('/api/register', body).then((r) => r.data)
|
|
}
|