mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-31 18:22:49 +00:00
36 lines
927 B
TypeScript
36 lines
927 B
TypeScript
import { defineStore } from 'pinia'
|
|
import documentApi from '@/api/shared/document'
|
|
import { type Ref } from 'vue'
|
|
|
|
const useDocumentStore = defineStore('documen', {
|
|
state: () => ({}),
|
|
actions: {
|
|
async asyncGetAllDocument(id: string, loading?: Ref<boolean>) {
|
|
return new Promise((resolve, reject) => {
|
|
documentApi
|
|
.getAllDocument(id, loading)
|
|
.then((res) => {
|
|
resolve(res)
|
|
})
|
|
.catch((error) => {
|
|
reject(error)
|
|
})
|
|
})
|
|
},
|
|
async asyncPostDocument(knowledgeId: string, data: any, loading?: Ref<boolean>) {
|
|
return new Promise((resolve, reject) => {
|
|
documentApi
|
|
.postMulDocument(knowledgeId, data, loading)
|
|
.then((data) => {
|
|
resolve(data)
|
|
})
|
|
.catch((error) => {
|
|
reject(error)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
})
|
|
|
|
export default useDocumentStore
|