feat(vue-app,flask): Vue 试验田全量对接与 Session 用户上下文统一
新增 vue-app(生成/收藏/历史/登录/优化/Android/饭菜/诗词/简历等),Flask 增加 user_context 并调整历史、生成、简历等路由;模板 base/generate 可访问性改进;补充部署说明与文档。 Made-with: Cursor
This commit is contained in:
28
vue-app/src/api/modules/auth.ts
Normal file
28
vue-app/src/api/modules/auth.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user