Files
financial_system_frontend/src/api/auth.ts
T
2026-09-11 13:56:36 +08:00

39 lines
855 B
TypeScript

import request from './request'
export interface UserProfile {
id: number
employeeNo: string
realName: string
avatarUrl: string
email: string
departmentName: string
position: string
userType: string
status: string
feishuStatus: string
lastLoginAt: string
}
export interface LoginResponse {
token: string
tokenType: string
expiresIn: number
user: UserProfile
}
export const authApi = {
feishuLogin: (code: string, state?: string): Promise<LoginResponse> =>
request.post('/auth/feishu-login', { code, state }),
getAuthUrl: (): Promise<{ authUrl: string }> => request.get('/feishu/auth-url'),
getUserInfo: (): Promise<UserProfile> =>
request.get('/auth/me'),
refreshToken: (): Promise<LoginResponse> =>
request.post('/auth/refresh'),
logout: (): Promise<void> =>
request.post('/auth/logout'),
}