refactor: add application access
This commit is contained in:
parent
ee5c199449
commit
66606bcaec
@ -187,6 +187,32 @@ const chat: (chat_id: string, data: any) => Promise<any> = (chat_id, data) => {
|
||||
const getChatUserAuthType: (loading?: Ref<boolean>) => Promise<any> = (loading) => {
|
||||
return get(`/chat_user/auth/types`, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取平台状态
|
||||
*/
|
||||
const getPlatformStatus: (application_id: string) => Promise<Result<any>> = (application_id) => {
|
||||
return get(`${prefix.value}/${application_id}/platform/status`)
|
||||
}
|
||||
/**
|
||||
* 更新平台状态
|
||||
*/
|
||||
const updatePlatformStatus: (application_id: string, data: any) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
data
|
||||
) => {
|
||||
return post(`${prefix.value}/${application_id}/platform/status`, data)
|
||||
}
|
||||
/**
|
||||
* 获取平台配置
|
||||
*/
|
||||
const getPlatformConfig: (application_id: string, type: string) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
type
|
||||
) => {
|
||||
return get(`${prefix.value}/${application_id}/platform/${type}`)
|
||||
}
|
||||
|
||||
export default {
|
||||
getAllApplication,
|
||||
getApplication,
|
||||
@ -203,4 +229,7 @@ export default {
|
||||
chat,
|
||||
getChatUserAuthType,
|
||||
getApplicationSetting,
|
||||
getPlatformStatus,
|
||||
updatePlatformStatus,
|
||||
getPlatformConfig
|
||||
}
|
||||
|
||||
@ -116,13 +116,13 @@ function refresh() {
|
||||
|
||||
function getPlatformStatus() {
|
||||
loading.value = true
|
||||
// applicationApi.getPlatformStatus(id).then((res: any) => {
|
||||
// platforms.forEach((platform) => {
|
||||
// platform.isActive = res.data[platform.key][1]
|
||||
// platform.exists = res.data[platform.key][0]
|
||||
// })
|
||||
// loading.value = false
|
||||
// })
|
||||
applicationApi.getPlatformStatus(id).then((res: any) => {
|
||||
platforms.forEach((platform) => {
|
||||
platform.isActive = res.data[platform.key][1]
|
||||
platform.exists = res.data[platform.key][0]
|
||||
})
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function changeStatus(type: string, value: boolean) {
|
||||
|
||||
@ -383,16 +383,16 @@ const open = async (id: string, type: PlatformType) => {
|
||||
dataLoaded.value = false
|
||||
formRef.value?.resetFields()
|
||||
try {
|
||||
// const res = await applicationApi.getPlatformConfig(id, type)
|
||||
// if (res.data) {
|
||||
// form[configType.value] = res.data
|
||||
// }
|
||||
// dataLoaded.value = true
|
||||
const res = await applicationApi.getPlatformConfig(id, type)
|
||||
if (res.data) {
|
||||
form[configType.value] = res.data
|
||||
}
|
||||
dataLoaded.value = true
|
||||
} catch {
|
||||
MsgError(t('views.application.tip.loadingErrorMessage'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
form[configType.value].callback_url = `${window.location.origin}/api/${type}/${id}`
|
||||
form[configType.value].callback_url = `${window.location.origin}/api/chat/${type}/${id}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user