feat:"完成页面接口的对接"
This commit is contained in:
22
管理后台/src/api/auth.ts
Normal file
22
管理后台/src/api/auth.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export interface LoginParams {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export interface LoginResult {
|
||||
user: any
|
||||
access_token: string
|
||||
refresh_token: string
|
||||
}
|
||||
|
||||
// 登录
|
||||
export const login = (data: LoginParams) => {
|
||||
return request.post<any, { code: number; message: string; data: LoginResult }>('/auth/login', data)
|
||||
}
|
||||
|
||||
// 刷新 token
|
||||
export const refreshToken = (refreshToken: string) => {
|
||||
return request.post('/auth/refresh', { refresh_token: refreshToken })
|
||||
}
|
||||
Reference in New Issue
Block a user