maxkb/ui/src/stores/modules/document.ts
wangdan-fit2cloud 46fb1b1b4e feat: shared
2025-06-25 12:55:51 +08:00

28 lines
733 B
TypeScript

import { defineStore } from 'pinia'
import { type Ref } from 'vue'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const useDocumentStore = defineStore('document', {
state: () => ({}),
actions: {
async asyncGetKnowledgeDocument(
id: string,
systemType: 'systemShare' | 'workspace' | 'systemManage' = 'workspace',
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
loadSharedApi({ type: 'document', systemType })
.getDocumentList(id, loading)
.then((res: any) => {
resolve(res)
})
.catch((error: any) => {
reject(error)
})
})
},
},
})
export default useDocumentStore