mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
perf: 优化接口文件
This commit is contained in:
parent
475ff183ac
commit
8994ac4b20
|
|
@ -135,7 +135,7 @@ const postAppAuthentication: (access_token: string, loading?: Ref<boolean>) => P
|
|||
"access_token": "string"
|
||||
}
|
||||
*/
|
||||
const getProfile: (loading?: Ref<boolean>) => Promise<any> = (loading) => {
|
||||
const getAppProfile: (loading?: Ref<boolean>) => Promise<any> = (loading) => {
|
||||
return get(`${prefix}/profile`, undefined, loading)
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ export default {
|
|||
getAccessToken,
|
||||
putAccessToken,
|
||||
postAppAuthentication,
|
||||
getProfile,
|
||||
getAppProfile,
|
||||
putChatVote,
|
||||
getApplicationHitTest,
|
||||
getApplicationModel,
|
||||
|
|
|
|||
|
|
@ -125,9 +125,9 @@ const getUserList: (email_or_username: string, loading?: Ref<boolean>) => Promis
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取version
|
||||
* 获取profile
|
||||
*/
|
||||
const getVersion: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
|
||||
const getProfile: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
|
||||
return get('/profile', undefined, loading)
|
||||
}
|
||||
|
||||
|
|
@ -155,6 +155,6 @@ export default {
|
|||
resetCurrentUserPassword,
|
||||
logout,
|
||||
getUserList,
|
||||
getVersion,
|
||||
getProfile,
|
||||
getValid
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,18 +63,25 @@ const useUserStore = defineStore({
|
|||
this.userType = num
|
||||
},
|
||||
|
||||
async asyncGetVersion() {
|
||||
return UserApi.getVersion().then((ok) => {
|
||||
this.version = ok.data?.version || '-'
|
||||
this.isXPack = ok.data?.IS_XPACK
|
||||
this.XPACK_LICENSE_IS_VALID = ok.data?.XPACK_LICENSE_IS_VALID
|
||||
async asyncGetProfile() {
|
||||
return new Promise((resolve, reject) => {
|
||||
UserApi.getProfile()
|
||||
.then((ok) => {
|
||||
this.version = ok.data?.version || '-'
|
||||
this.isXPack = ok.data?.IS_XPACK
|
||||
this.XPACK_LICENSE_IS_VALID = ok.data?.XPACK_LICENSE_IS_VALID
|
||||
resolve(ok)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async profile() {
|
||||
return UserApi.profile().then((ok) => {
|
||||
this.userInfo = ok.data
|
||||
this.asyncGetVersion()
|
||||
this.asyncGetProfile()
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -35,15 +35,15 @@ function getAccessToken(token: string) {
|
|||
application
|
||||
.asyncAppAuthentication(token, loading)
|
||||
.then(() => {
|
||||
getProfile()
|
||||
getAppProfile()
|
||||
})
|
||||
.catch(() => {
|
||||
applicationAvailable.value = false
|
||||
})
|
||||
}
|
||||
function getProfile() {
|
||||
function getAppProfile() {
|
||||
applicationApi
|
||||
.getProfile(loading)
|
||||
.getAppProfile(loading)
|
||||
.then((res) => {
|
||||
applicationDetail.value = res.data
|
||||
})
|
||||
|
|
|
|||
|
|
@ -148,15 +148,15 @@ function getAccessToken(token: string) {
|
|||
application
|
||||
.asyncAppAuthentication(token, loading)
|
||||
.then(() => {
|
||||
getProfile()
|
||||
getAppProfile()
|
||||
})
|
||||
.catch(() => {
|
||||
applicationAvailable.value = false
|
||||
})
|
||||
}
|
||||
function getProfile() {
|
||||
function getAppProfile() {
|
||||
applicationApi
|
||||
.getProfile(loading)
|
||||
.getAppProfile(loading)
|
||||
.then((res) => {
|
||||
applicationDetail.value = res.data
|
||||
getChatLog(applicationDetail.value.id)
|
||||
|
|
|
|||
|
|
@ -189,16 +189,16 @@ function getAccessToken(token: string) {
|
|||
application
|
||||
.asyncAppAuthentication(token, loading)
|
||||
.then(() => {
|
||||
getProfile()
|
||||
getAppProfile()
|
||||
})
|
||||
.catch(() => {
|
||||
applicationAvailable.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function getProfile() {
|
||||
function getAppProfile() {
|
||||
applicationApi
|
||||
.getProfile(loading)
|
||||
.getAppProfile(loading)
|
||||
.then((res) => {
|
||||
applicationDetail.value = res.data
|
||||
getChatLog(applicationDetail.value.id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue