45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import { service } from "./share/request"
|
|
|
|
/**
|
|
* 获取个人信息
|
|
*/
|
|
export const getUserInfo = (params) => {
|
|
return service({
|
|
url: '/admin/user/info',
|
|
method: 'get',
|
|
params,
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 刷新token
|
|
*/
|
|
export const refreshToken = (refresh_token) => {
|
|
const basicAuth = 'Basic ' + window.btoa('pig:pig');
|
|
const grant_type = 'refresh_token';
|
|
const scope = 'server';
|
|
return service({
|
|
url: '/auth/oauth2/token',
|
|
method: 'post',
|
|
headers: {
|
|
skipToken: true,
|
|
Authorization: basicAuth,
|
|
'Content-Type': "application/x-www-form-urlencoded",
|
|
},
|
|
params: { refresh_token, grant_type, scope },
|
|
})
|
|
}
|
|
|
|
export const checkToken = (token) => {
|
|
const basicAuth = 'Basic ' + window.btoa('pig:pig');
|
|
return service({
|
|
url: '/auth/token/check_token',
|
|
method: 'get',
|
|
headers: {
|
|
skipToken: true,
|
|
Authorization: basicAuth,
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
},
|
|
params: { token },
|
|
})
|
|
} |