UnisKB/ui/src/api/application/application-xpack.ts

49 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-06-03 09:29:33 +00:00
import { Result } from '@/request/Result'
import { get, put } from '@/request/index'
2025-06-16 09:30:51 +00:00
import useStore from '@/stores'
2025-06-03 09:29:33 +00:00
import { type Ref } from 'vue'
2025-06-16 09:30:51 +00:00
const prefix: any = { _value: '/workspace/' }
Object.defineProperty(prefix, 'value', {
get: function () {
const { user } = useStore()
return this._value + user.getWorkspaceId() + '/application'
},
})
2025-06-03 09:29:33 +00:00
/**
* -AccessToken
* @param application_id
*/
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
application_id,
2025-06-16 09:30:51 +00:00
loading,
2025-06-03 09:29:33 +00:00
) => {
2025-06-16 09:30:51 +00:00
return get(`${prefix.value}/${application_id}/setting`, undefined, loading)
2025-06-03 09:29:33 +00:00
}
/**
* -AccessToken
* @param application_id
* data {
* "show_source": boolean,
* "show_history": boolean,
* "draggable": boolean,
* "show_guide": boolean,
* "avatar": file,
* "float_icon": file,
* }
*/
const putAccessToken: (
application_id: string,
data: any,
2025-06-16 09:30:51 +00:00
loading?: Ref<boolean>,
2025-06-03 09:29:33 +00:00
) => Promise<Result<any>> = (application_id, data, loading) => {
2025-06-16 09:30:51 +00:00
return put(`${prefix.value}/${application_id}/setting`, data, undefined, loading)
2025-06-03 09:29:33 +00:00
}
export default {
getAccessToken,
2025-06-16 09:30:51 +00:00
putAccessToken,
2025-06-03 09:29:33 +00:00
}