初始化
This commit is contained in:
commit
3a4e81a070
43 files changed
+10871
No files matched your search
@@ -0,0 +1,38 @@
|
||||
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'),
|
||||
}
|
||||