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

30 lines
439 B
JavaScript
Raw Normal View History

2017-08-28 05:12:44 +00:00
import fetch from '@/utils/fetch'
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
}
2017-04-24 06:15:42 +00:00
return fetch({
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() {
2017-04-24 06:15:42 +00:00
return fetch({
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) {
2017-04-24 06:15:42 +00:00
return fetch({
url: '/user/info',
method: 'get',
params: { token }
2017-08-22 07:09:25 +00:00
})
2017-04-24 06:15:42 +00:00
}