You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.0 KiB
69 lines
1.0 KiB
|
3 weeks ago
|
import http from '@/http/api.js'
|
||
|
|
|
||
|
|
// 获取token
|
||
|
|
const token = (tenantId, username, password, type) => {
|
||
|
|
return http.request({
|
||
|
|
url: '/blade-auth/oauth/token',
|
||
|
|
method: 'POST',
|
||
|
|
header: {
|
||
|
|
'Tenant-Id': tenantId
|
||
|
|
},
|
||
|
|
params: {
|
||
|
|
tenantId,
|
||
|
|
username,
|
||
|
|
password,
|
||
|
|
grant_type: "password",
|
||
|
|
scope: "all",
|
||
|
|
type
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
const refreshToken = (refresh_token, tenantId) => {
|
||
|
|
return http.request({
|
||
|
|
url: '/blade-auth/oauth/token',
|
||
|
|
method: 'post',
|
||
|
|
headers: {
|
||
|
|
'Tenant-Id': tenantId
|
||
|
|
},
|
||
|
|
params: {
|
||
|
|
tenantId,
|
||
|
|
refresh_token,
|
||
|
|
grant_type: "refresh_token",
|
||
|
|
scope: "all",
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// 获取用户信息
|
||
|
|
const userInfo = () => {
|
||
|
|
return http.request({
|
||
|
|
url: '/blade-system/user/info',
|
||
|
|
method: 'GET',
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// 获取用户信息
|
||
|
|
export const getUser = (id) => {
|
||
|
|
return http.request({
|
||
|
|
url: '/blade-system/user/detail',
|
||
|
|
method: 'GET',
|
||
|
|
params: { id }
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// 退出
|
||
|
|
const logout = () => {
|
||
|
|
return http.request({
|
||
|
|
url: '/blade-auth/oauth/logout',
|
||
|
|
method: 'get',
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
export default {
|
||
|
|
token,
|
||
|
|
userInfo,
|
||
|
|
refreshToken,
|
||
|
|
logout
|
||
|
|
}
|