2023-11-14 10:12:55 +00:00
|
|
|
import { defineStore } from 'pinia'
|
2023-11-22 10:37:08 +00:00
|
|
|
import paragraphApi from '@/api/paragraph'
|
2023-11-14 10:12:55 +00:00
|
|
|
|
|
|
|
|
const useParagraphStore = defineStore({
|
|
|
|
|
id: 'paragraph',
|
|
|
|
|
state: () => ({}),
|
|
|
|
|
actions: {
|
|
|
|
|
async asyncPutParagraph(datasetId: string, documentId: string, paragraphId: string, data: any) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
2023-11-22 10:37:08 +00:00
|
|
|
paragraphApi
|
2023-11-14 10:12:55 +00:00
|
|
|
.putParagraph(datasetId, documentId, paragraphId, data)
|
|
|
|
|
.then((data) => {
|
|
|
|
|
resolve(data)
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
reject(error)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default useParagraphStore
|