fe-drone-ci/src/api/login.js

30 lines
449 B
JavaScript
Raw Normal View History

import request from '@/utils/request'
2017-04-24 06:15:42 +00:00
2017-08-23 03:16:54 +00:00
export function loginByUsername(username, password) {
2017-04-24 06:15:42 +00:00
const data = {
2017-08-22 06:26:19 +00:00
username,
2017-04-24 06:15:42 +00:00
password
2017-08-22 07:09:25 +00:00
}
return request({
2017-08-22 06:26:19 +00:00
url: '/login/login',
2017-04-24 06:15:42 +00:00
method: 'post',
2017-05-10 07:47:53 +00:00
data
2017-08-22 07:09:25 +00:00
})
2017-04-24 06:15:42 +00:00
}
2017-08-23 03:16:54 +00:00
export function logout() {
return request({
2017-04-24 06:15:42 +00:00
url: '/login/logout',
method: 'post'
2017-08-22 07:09:25 +00:00
})
2017-04-24 06:15:42 +00:00
}
2017-08-23 03:39:16 +00:00
export function getUserInfo(token) {
return request({
2017-04-24 06:15:42 +00:00
url: '/user/info',
method: 'get',
params: { token }
2017-08-22 07:09:25 +00:00
})
2017-04-24 06:15:42 +00:00
}