refactor: add function sendOcr

This commit is contained in:
Net 2024-08-26 18:05:05 +07:00
parent f308f6da3c
commit 6d1b12fd2f

34
src/stores/ocr/index.ts Normal file
View file

@ -0,0 +1,34 @@
import { ref } from 'vue';
import { api } from 'src/boot/axios';
import { defineStore } from 'pinia';
import axios from 'axios';
const useOcr = defineStore('useOcrStore', () => {
const baseUrl = import.meta.env.VITE_API_BASE_URL_OCR;
async function sendOcr(
payload: {
file: File;
},
flow?: {
sessionId?: string;
refTransactionId?: string;
transactionId?: string;
},
) {
const res = await axios
.post(`${baseUrl}/`, payload.file, {
headers: { 'Content-Type': payload.file?.type },
onUploadProgress: (e) => console.log(e),
})
.catch((e) => console.error(e));
// ]);
}
return {
sendOcr,
};
});
export default useOcr;