init
This commit is contained in:
38
src/api/user.js
Normal file
38
src/api/user.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import request from '@/utils/request'
|
||||
import { encryptedData } from '@/utils/encrypt'
|
||||
import { loginRSA, tokenName } from '@/config'
|
||||
|
||||
export async function login(data) {
|
||||
if (loginRSA) {
|
||||
data = await encryptedData(data)
|
||||
}
|
||||
return request({
|
||||
url: '/api/auth/login',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserInfo(accessToken) {
|
||||
return request({
|
||||
url: '/management/api/user/current',
|
||||
method: 'post',
|
||||
data: {
|
||||
[tokenName]: accessToken,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return request({
|
||||
url: '/api/auth/logout',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
|
||||
export function register() {
|
||||
return request({
|
||||
url: '/register',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user