This commit is contained in:
wangli 2026-01-22 00:20:25 +08:00
parent 59408d1d80
commit 016b53f454
5 changed files with 51 additions and 7 deletions

44
.gitignore vendored Normal file
View File

@ -0,0 +1,44 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
WorkflowCoreService.java
WorkflowManageService.java
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
node_modules
application-local.yml
*.log
rebel.xml
.flattened-pom.xml
.DS_Store
logs/

View File

@ -3,12 +3,12 @@ import type { LoginRequest, LoginResponse, ApiResponse } from '@/types'
// 用户登录
export const login = (data: LoginRequest): Promise<LoginResponse> => {
return post('/login', data)
return post('/auth/login', data)
}
// 验证 Token
export const verifyToken = (): Promise<{ authenticated: boolean; user_id?: number; username?: string; is_admin?: boolean }> => {
return get('/verify')
return get('/auth/verify')
}
// 用户登出

View File

@ -178,8 +178,8 @@ export function Login() {
loginData = { email: emailForCode, verification_code: verificationCode }
}
const result = await login(loginData)
if (result.success && result.token) {
setAuth(result.token, { user_id: result.user_id!, username: result.username!, is_admin: result.is_admin! })
if (result.success && result.accessToken) {
setAuth(result.accessToken, { user_id: result.user_id!, username: result.username!, is_admin: result.is_admin! })
addToast({ type: 'success', message: '登录成功' })
navigate('/dashboard')
} else {

View File

@ -16,7 +16,7 @@ export interface LoginRequest {
export interface LoginResponse {
success: boolean
message?: string
token?: string
accessToken?: string
user_id?: number
username?: string
is_admin?: boolean

View File

@ -17,7 +17,7 @@ export default defineConfig(({ command }) => ({
target: 'http://localhost:8080',
changeOrigin: true,
},
'/login': {
'/auth/login': {
target: 'http://localhost:8080',
changeOrigin: true,
bypass: (req) => {
@ -26,7 +26,7 @@ export default defineConfig(({ command }) => ({
}
},
},
'/verify': {
'/auth/verify': {
target: 'http://localhost:8080',
changeOrigin: true,
},